WindowsRuntimeBufferExtensions::ToArray Method (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.
This API is not CLS-compliant. Namespace: System.Runtime.InteropServices.WindowsRuntime
Assembly: System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)
[ExtensionAttribute] [CLSCompliantAttribute(false)] public: static array<unsigned char>^ ToArray( IBuffer^ source, unsigned int 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.
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).| Exception | Condition |
|---|---|
| ArgumentNullException | source is nullptr. |
| 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. |