Redigera

Dela via


IsolatedStorageFileStream.Lock(Int64, Int64) Method

Definition

Prevents other processes from reading from or writing to the stream.

public:
 override void Lock(long position, long length);
public override void Lock (long position, long length);
[System.Runtime.Versioning.UnsupportedOSPlatform("macos")]
public override void Lock (long position, long length);
override this.Lock : int64 * int64 -> unit
[<System.Runtime.Versioning.UnsupportedOSPlatform("macos")>]
override this.Lock : int64 * int64 -> unit
Public Overrides Sub Lock (position As Long, length As Long)

Parameters

position
Int64

The starting position of the range to lock. The value of this parameter must be equal to or greater than 0 (zero).

length
Int64

The number of bytes to lock.

Attributes

Exceptions

position or length is negative.

The file is closed.

The process cannot access the file because another process has locked a portion of the file.

Remarks

Locking a range of a file stream gives the threads of the locking process exclusive access to that range of the file stream.

Applies to