FileStreamExensions.SafeLock Method
|
|
Locks a region in a stream. Contains TRY CATCH mechanism.
命名空间:
XSharp
程序集:
XSharp.Core (在 XSharp.Core.dll 中) 版本:2.24 GA
Syntax STATIC METHOD SafeLock(
SELF oStream AS FileStream,
offset AS INT64,
length AS INT64
) AS LOGIC
public static bool SafeLock(
this FileStream oStream,
long offset,
long length
)
Request Example
查看代码Parameters
- oStream
- 类型:FileStream
The stream to lock. - offset
- 类型:Int64
Start of the region to lock. The method checks to see that the location is >= 0. - length
- 类型:Int64
Size of the region to lock. The method checks to see that the size is > 0.
Return Value
类型:
LogicTRUE 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