UnmanagedMemoryStream.Initialize 方法

定義

以安全緩衝區或使用 Unmanaged 記憶體位置的指標,初始化 UnmanagedMemoryStream 類別的新執行個體。

多載

Initialize(Byte*, Int64, Int64, FileAccess)

使用 Unmanaged 記憶體位置的指標,初始化 UnmanagedMemoryStream 類別的新執行個體。

Initialize(SafeBuffer, Int64, Int64, FileAccess)

在安全緩衝區中使用指定的位移、長度和檔案存取,初始化 UnmanagedMemoryStream 類別的新執行個體。

Initialize(Byte*, Int64, Int64, FileAccess)

來源:
UnmanagedMemoryStream.cs
來源:
UnmanagedMemoryStream.cs
來源:
UnmanagedMemoryStream.cs

重要

此 API 不符合 CLS 規範。

使用 Unmanaged 記憶體位置的指標,初始化 UnmanagedMemoryStream 類別的新執行個體。

protected:
 void Initialize(System::Byte* pointer, long length, long capacity, System::IO::FileAccess access);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
protected void Initialize (byte* pointer, long length, long capacity, System.IO.FileAccess access);
[System.CLSCompliant(false)]
protected void Initialize (byte* pointer, long length, long capacity, System.IO.FileAccess access);
protected void Initialize (byte* pointer, long length, long capacity, System.IO.FileAccess access);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
[<System.CLSCompliant(false)>]
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit

參數

pointer
Byte*

Unmanaged 記憶體位置的指標。

length
Int64

要使用的記憶體長度。

capacity
Int64

指派給資料流的記憶體總量。

access
FileAccess

其中一個 FileAccess 值。

屬性

例外狀況

使用者沒有所需要的使用權限。

pointer 值為 null

length 值小於 0。

-或-

capacity 值小於 0。

-或-

length 值的大小足以造成溢位。

備註

這個方法相當於建 UnmanagedMemoryStream 構函式。 它支援在設定數據流變數之前需要初始化指標的方法,因此無法呼叫參數化建構函式。 這類方法應該使用無參數建構函式、 UnmanagedMemoryStream()初始化指標,然後叫用 Initialize 方法。

適用於

Initialize(SafeBuffer, Int64, Int64, FileAccess)

來源:
UnmanagedMemoryStream.cs
來源:
UnmanagedMemoryStream.cs
來源:
UnmanagedMemoryStream.cs

在安全緩衝區中使用指定的位移、長度和檔案存取,初始化 UnmanagedMemoryStream 類別的新執行個體。

protected:
 void Initialize(System::Runtime::InteropServices::SafeBuffer ^ buffer, long offset, long length, System::IO::FileAccess access);
protected void Initialize (System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access);
member this.Initialize : System.Runtime.InteropServices.SafeBuffer * int64 * int64 * System.IO.FileAccess -> unit
Protected Sub Initialize (buffer As SafeBuffer, offset As Long, length As Long, access As FileAccess)

參數

buffer
SafeBuffer

包含 Unmanaged 記憶體資料流的緩衝區。

offset
Int64

緩衝區中的位元組位置,Unmanaged 記憶體資料流會在此處開始。

length
Int64

Unmanaged 記憶體資料流的長度。

access
FileAccess

Unmanaged 記憶體資料流的檔案存取模式。

適用於