Export (0) Print
Expand All

WindowsRuntimeBufferExtensions.ToArray Method (IBuffer, UInt32, Int32)

.NET Framework 4.5

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.

This API is not CLS-compliant. 

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

[CLSCompliantAttribute(false)]
public static byte[] ToArray(
	this IBuffer source,
	uint sourceIndex,
	int count
)

Parameters

source
Type: IBuffer

The buffer whose contents populate the new array.

sourceIndex
Type: System.UInt32

The index in source to begin copying data from.

count
Type: System.Int32

The number of bytes to copy.

Return Value

Type: System.Byte[]
A byte array that contains the specified range of bytes.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IBuffer. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

ExceptionCondition
ArgumentNullException

source is null.

ArgumentOutOfRangeException

count or sourceIndex is less than 0 (zero).

ArgumentException

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.

.NET Framework

Supported in: 4.5

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Silverlight 8.1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft