WindowsRuntimeBufferExtensions.ToArray Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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);
[<System.CLSCompliant(false)>]
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
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.
Applies to
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);
[<System.CLSCompliant(false)>]
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
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
.