語言

IsolatedStorageFileStream.Lock(Int64, Int64) 方法

定義

防止其他進程讀取或寫入數據流。

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

參數

position
Int64

鎖定距離的起始位置。 此參數的值必須等於或大於0(0)。

length
Int64

要鎖定的位元組數。

屬性

例外狀況

position 或 length 是陰性。

檔案已結案。

處理序無法存取檔案,因為其他處理序鎖定了該檔案的一部分。

備註

鎖定檔案串流的某個範圍,會讓鎖定程序的執行緒對該檔案串流範圍有專屬存取權。

適用於