SafeBuffer.Initialize 方法

定义

指定要分配的内存缓冲区的大小。 在使用 SafeBuffer 实例之前,必须调用此方法。

重载

Initialize(UInt64)

定义内存区域的分配大小(以字节为单位)。 在使用 SafeBuffer 实例之前,必须调用此方法。

Initialize(UInt32, UInt32)

通过使用指定的元素数和元素大小,指定内存缓冲区的分配大小。 在使用 SafeBuffer 实例之前,必须调用此方法。

Initialize<T>(UInt32)

通过指定值类型的数目,定义内存区域的分配大小。 在使用 SafeBuffer 实例之前,必须调用此方法。

Initialize(UInt64)

Source:
SafeBuffer.cs
Source:
SafeBuffer.cs
Source:
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)

Source:
SafeBuffer.cs
Source:
SafeBuffer.cs
Source:
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 小于零。

- 或 -

numElementssizeOfEachElement 的乘积大于可用地址空间。

注解

此方法将内存区域所需的大小定义为数组中的元素数乘以每个元素的大小。

适用于

Initialize<T>(UInt32)

Source:
SafeBuffer.cs
Source:
SafeBuffer.cs
Source:
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 与每个元素大小的乘积大于可用地址空间。

适用于