Bewerken

Share via


SafeBuffer.Initialize Method

Definition

Specifies the size of the memory buffer to allocate. You must call this method before you use the SafeBuffer instance.

Overloads

Initialize(UInt64)

Defines the allocation size of the memory region in bytes. You must call this method before you use the SafeBuffer instance.

Initialize(UInt32, UInt32)

Specifies the allocation size of the memory buffer by using the specified number of elements and element size. You must call this method before you use the SafeBuffer instance.

Initialize<T>(UInt32)

Defines the allocation size of the memory region by specifying the number of value types. You must call this method before you use the SafeBuffer instance.

Initialize(UInt64)

Source:
SafeBuffer.cs
Source:
SafeBuffer.cs
Source:
SafeBuffer.cs

Important

This API is not CLS-compliant.

Defines the allocation size of the memory region in bytes. You must call this method before you use the SafeBuffer instance.

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)

Parameters

numBytes
UInt64

The number of bytes in the buffer.

Attributes

Exceptions

numBytes is less than zero.

-or-

numBytes is greater than the available address space.

Applies to

Initialize(UInt32, UInt32)

Source:
SafeBuffer.cs
Source:
SafeBuffer.cs
Source:
SafeBuffer.cs

Important

This API is not CLS-compliant.

Specifies the allocation size of the memory buffer by using the specified number of elements and element size. You must call this method before you use the SafeBuffer instance.

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)

Parameters

numElements
UInt32

The number of elements in the buffer.

sizeOfEachElement
UInt32

The size of each element in the buffer.

Attributes

Exceptions

numElements is less than zero.

-or-

sizeOfEachElement is less than zero.

-or-

numElements multiplied by sizeOfEachElement is greater than the available address space.

Remarks

This method defines the required size of the memory region as the number of elements in an array multiplied by the size of each element.

Applies to

Initialize<T>(UInt32)

Source:
SafeBuffer.cs
Source:
SafeBuffer.cs
Source:
SafeBuffer.cs

Important

This API is not CLS-compliant.

Defines the allocation size of the memory region by specifying the number of value types. You must call this method before you use the SafeBuffer instance.

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)

Type Parameters

T

The value type to allocate memory for.

Parameters

numElements
UInt32

The number of elements of the value type to allocate memory for.

Attributes

Exceptions

numElements is less than zero.

-or-

numElements multiplied by the size of each element is greater than the available address space.

Applies to