Share via


IsolatedStorageFileStream.Lock(Int64, Int64) 方法

定義

防止其他處理程序讀取或寫入資料流。

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)

參數

position
Int64

要鎖定之範圍的開始位置。 這個參數的值必須等於或大於 0 (零)。

length
Int64

要鎖定的位元組數目。

屬性

例外狀況

positionlength 為負。

檔案已關閉。

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

備註

鎖定檔案數據流的範圍可提供鎖定進程獨佔存取該檔案數據流範圍的線程。

適用於