WindowsRuntimeBufferExtensions.AsBuffer Method

Definition

Overloads

AsBuffer(Byte[])

Returns a Windows.Storage.Streams.IBuffer interface that represents the specified byte array.

AsBuffer(Byte[], Int32, Int32)

Returns a Windows.Storage.Streams.IBuffer interface that represents a range of bytes in the specified byte array.

AsBuffer(Byte[], Int32, Int32, Int32)

Returns a Windows.Storage.Streams.IBuffer interface that represents a range of bytes in the specified byte array. Optionally sets the Length property of the IBuffer to a value that is less than the capacity.

AsBuffer(Byte[])

Important

This API is not CLS-compliant.

Returns a Windows.Storage.Streams.IBuffer interface that represents the specified byte array.

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

Parameters

source
Byte[]

The array to represent.

Returns

A Windows.Storage.Streams.IBuffer interface that represents the specified byte array.

Attributes

Exceptions

source is null.

Applies to

AsBuffer(Byte[], Int32, Int32)

Important

This API is not CLS-compliant.

Returns a Windows.Storage.Streams.IBuffer interface that represents a range of bytes in the specified byte array.

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

Parameters

source
Byte[]

The array that contains the range of bytes that is represented by the IBuffer.

offset
Int32

The offset in source where the range begins.

length
Int32

The length of the range that is represented by the IBuffer.

Returns

An IBuffer interface that represents the specified range of bytes in source.

Attributes

Exceptions

source is null.

offset or length is less than 0 (zero).

The array is not large enough to serve as a backing store for the IBuffer; that is, the number of bytes in source, beginning at offset, is less than length.

Applies to

AsBuffer(Byte[], Int32, Int32, Int32)

Important

This API is not CLS-compliant.

Returns a Windows.Storage.Streams.IBuffer interface that represents a range of bytes in the specified byte array. Optionally sets the Length property of the IBuffer to a value that is less than the capacity.

public:
[System::Runtime::CompilerServices::Extension]
 static Windows::Storage::Streams::IBuffer ^ AsBuffer(cli::array <System::Byte> ^ source, int offset, int length, int capacity);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer AsBuffer (this byte[] source, int offset, int length, int capacity);
[<System.CLSCompliant(false)>]
static member AsBuffer : byte[] * int * int * int -> Windows.Storage.Streams.IBuffer
<Extension()>
Public Function AsBuffer (source As Byte(), offset As Integer, length As Integer, capacity As Integer) As IBuffer

Parameters

source
Byte[]

The array that contains the range of bytes that is represented by the IBuffer.

offset
Int32

The offset in source where the range begins.

length
Int32

The value of the Length property of the IBuffer.

capacity
Int32

The size of the range that is represented by the IBuffer. The Capacity property of the IBuffer is set to this value.

Returns

An IBuffer interface that represents the specified range of bytes in source and that has the specified Length property value.

Attributes

Exceptions

source is null.

offset, length, or capacity is less than 0 (zero).

length is greater than capacity. -or-The array is not large enough to serve as a backing store for the IBuffer; that is, the number of bytes in source, beginning at offset, is less than length or capacity.

Applies to