WindowsRuntimeBufferExtensions.ToArray Method

Definition

Overloads

ToArray(IBuffer)

Returns a new array that is created from the contents of the specified buffer (Windows.Storage.Streams.IBuffer). The size of the array is the value of the Length property of the IBuffer.

ToArray(IBuffer, UInt32, Int32)

Returns a new array that is created from the contents of the specified buffer (Windows.Storage.Streams.IBuffer), starting at a specified offset and including a specified number of bytes.

ToArray(IBuffer)

Important

This API is not CLS-compliant.

Returns a new array that is created from the contents of the specified buffer (Windows.Storage.Streams.IBuffer). The size of the array is the value of the Length property of the IBuffer.

public:
[System::Runtime::CompilerServices::Extension]
 static cli::array <System::Byte> ^ ToArray(Windows::Storage::Streams::IBuffer ^ source);
[System.CLSCompliant(false)]
public static byte[] ToArray (this Windows.Storage.Streams.IBuffer source);
static member ToArray : Windows.Storage.Streams.IBuffer -> byte[]
<Extension()>
Public Function ToArray (source As IBuffer) As Byte()

Parameters

source
IBuffer

The buffer whose contents populate the new array.

Returns

Byte[]

A byte array that contains the bytes in the specified IBuffer, beginning at offset 0 (zero) and including a number of bytes equal to the value of the Length property of the IBuffer.

Attributes

Exceptions

source is null.

ToArray(IBuffer, UInt32, Int32)

Important

This API is not CLS-compliant.

Returns a new array that is created from the contents of the specified buffer (Windows.Storage.Streams.IBuffer), starting at a specified offset and including a specified number of bytes.

public:
[System::Runtime::CompilerServices::Extension]
 static cli::array <System::Byte> ^ ToArray(Windows::Storage::Streams::IBuffer ^ source, System::UInt32 sourceIndex, int count);
[System.CLSCompliant(false)]
public static byte[] ToArray (this Windows.Storage.Streams.IBuffer source, uint sourceIndex, int count);
static member ToArray : Windows.Storage.Streams.IBuffer * uint32 * int -> byte[]
<Extension()>
Public Function ToArray (source As IBuffer, sourceIndex As UInteger, count As Integer) As Byte()

Parameters

source
IBuffer

The buffer whose contents populate the new array.

sourceIndex
UInt32

The index in source to begin copying data from.

count
Int32

The number of bytes to copy.

Returns

Byte[]

A byte array that contains the specified range of bytes.

Attributes

Exceptions

source is null.

count or sourceIndex is less than 0 (zero).

sourceIndex is greater than or equal to the capacity of source. -or-The number of bytes in source, beginning at sourceIndex, is less than count.

Applies to