SafeBuffer.Initialize 方法

定義

指定要配置的記憶體緩衝區大小。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

多載

Initialize(UInt64)

定義記憶體區域的配置大小 (以位元組為單位)。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

Initialize(UInt32, UInt32)

使用指定的項目數目和項目大小,指定記憶體緩衝區的配置大小。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

Initialize<T>(UInt32)

指定實值型別的數目,定義記憶體區域的配置大小。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

Initialize(UInt64)

來源:
SafeBuffer.cs
來源:
SafeBuffer.cs
來源:
SafeBuffer.cs

重要

此 API 不符合 CLS 規範。

定義記憶體區域的配置大小 (以位元組為單位)。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

public:
 void Initialize(System::UInt64 numBytes);
[System.CLSCompliant(false)]
public void Initialize (ulong numBytes);
[<System.CLSCompliant(false)>]
member this.Initialize : uint64 -> unit
Public Sub Initialize (numBytes As ULong)

參數

numBytes
UInt64

緩衝區中的位元組數目。

屬性

例外狀況

numBytes 小於零。

-或-

numBytes 大於可用的位址空間。

適用於

Initialize(UInt32, UInt32)

來源:
SafeBuffer.cs
來源:
SafeBuffer.cs
來源:
SafeBuffer.cs

重要

此 API 不符合 CLS 規範。

使用指定的項目數目和項目大小,指定記憶體緩衝區的配置大小。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

public:
 void Initialize(System::UInt32 numElements, System::UInt32 sizeOfEachElement);
[System.CLSCompliant(false)]
public void Initialize (uint numElements, uint sizeOfEachElement);
[<System.CLSCompliant(false)>]
member this.Initialize : uint32 * uint32 -> unit
Public Sub Initialize (numElements As UInteger, sizeOfEachElement As UInteger)

參數

numElements
UInt32

緩衝區中的項目數。

sizeOfEachElement
UInt32

緩衝區中每個項目的大小。

屬性

例外狀況

numElements 小於零。

-或-

sizeOfEachElement 小於零。

-或-

numElements 乘以 sizeOfEachElement 大於可用的位址空間。

備註

這個方法會將記憶體區域的必要大小定義為陣列中的元素數目乘以每個元素的大小。

適用於

Initialize<T>(UInt32)

來源:
SafeBuffer.cs
來源:
SafeBuffer.cs
來源:
SafeBuffer.cs

重要

此 API 不符合 CLS 規範。

指定實值型別的數目,定義記憶體區域的配置大小。 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。

public:
generic <typename T>
 where T : value class void Initialize(System::UInt32 numElements);
[System.CLSCompliant(false)]
public void Initialize<T> (uint numElements) where T : struct;
[<System.CLSCompliant(false)>]
member this.Initialize : uint32 -> unit (requires 'T : struct)
Public Sub Initialize(Of T As Structure) (numElements As UInteger)

類型參數

T

要配置記憶體的實值型別。

參數

numElements
UInt32

要配置記憶體之實值型別的項目數目。

屬性

例外狀況

numElements 小於零。

-或-

numElements 乘以每個元素的大小,大於可用的位址空間。

適用於