Click or drag to resize

FileStreamExensions.SafeLock Method

X#
Locks a region in a stream. Contains TRY CATCH mechanism.

Namespace:  XSharp
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 STATIC METHOD SafeLock(
	SELF oStream AS FileStream,
	offset AS INT64,
	length AS INT64
) AS LOGIC
Request Example View Source

Parameters

oStream
Type: FileStream
The stream to lock.
offset
Type: Int64
Start of the region to lock. The method checks to see that the location is >= 0.
length
Type: Int64
Size of the region to lock. The method checks to see that the size is > 0.

Return Value

Type: Logic
TRUE when succesfull, FALSE when an exception occurred during reading or when offset or length were invalid.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type FileStream. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also