Windows apps
Collapse the table of content
Expand the table of content

WindowsRuntimeBuffer::Create Method (array<Byte>, Int32, Int32, Int32)

.NET Framework (current version)

Returns a Windows.Storage.Streams.IBuffer interface that contains a specified range of bytes copied from a byte array. If the specified capacity is greater than the number of bytes copied, the rest of the buffer is zero-filled.

This API is not CLS-compliant. 

Namespace:  System.Runtime.InteropServices.WindowsRuntime
Assembly:  System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)

[CLSCompliantAttribute(false)]
public:
static IBuffer^ Create(
	array<unsigned char>^ data, 
	int offset, 
	int length, 
	int capacity
)

Parameters

data
Type: array<System::Byte>

The byte array to copy from.

offset
Type: System::Int32

The offset in data from which copying begins.

length
Type: System::Int32

The number of bytes to copy.

capacity
Type: System::Int32

The maximum number of bytes the buffer can hold; if this is greater than length, the rest of the bytes in the buffer are initialized to 0 (zero).

Return Value

Type: IBuffer
A Windows.Storage.Streams.IBuffer interface that contains the specified range of bytes. If capacity is greater than length, the rest of the buffer is zero-filled.

ExceptionCondition
ArgumentOutOfRangeException

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

ArgumentNullException

data is nullptr.

ArgumentException

Starting at offset, data does not contain length elements.

-or-

Starting at offset, data does not contain capacity elements.

.NET Framework

Supported in: 4.6, 4.5

.NET for Windows Phone apps

Supported in: Windows Phone Silverlight 8
Show:
© 2017 Microsoft