WindowsRuntimeBufferExtensions.ToArray 方法

定義

多載

名稱 Description
ToArray(IBuffer)

回傳一個由指定緩衝區內容建立的新陣列(Windows.Storage.Streams.Buffer)。 陣列大小即為 IBuffer 長度屬性的值。

ToArray(IBuffer, UInt32, Int32)

回傳一個由指定緩衝區內容建立的新陣列(Windows.Storage.Streams.IBuffer),從指定的偏移量開始,並包含指定數量的位元組。

ToArray(IBuffer)

重要

此 API 不符合 CLS 規範。

回傳一個由指定緩衝區內容建立的新陣列(Windows.Storage.Streams.Buffer)。 陣列大小即為 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()

參數

source
Windows.Storage.Streams.IBuffer

該緩衝區的內容填充新陣列。

傳回

Byte[]

一個位元組陣列,包含指定 IBuffer 中的位元組,從偏移量 0(零)開始,包含等於 IBuffer 長度屬性值的位元組數。

屬性

例外狀況

source 為 null。

適用於

ToArray(IBuffer, UInt32, Int32)

重要

此 API 不符合 CLS 規範。

回傳一個由指定緩衝區內容建立的新陣列(Windows.Storage.Streams.IBuffer),從指定的偏移量開始,並包含指定數量的位元組。

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()

參數

source
Windows.Storage.Streams.IBuffer

該緩衝區的內容填充新陣列。

sourceIndex
UInt32

索引開始 source 複製資料。

count
Int32

要複製的位元組數。

傳回

Byte[]

一個包含指定位元組範圍的位元組陣列。

屬性

例外狀況

source 為 null。

countsourceIndex 小於0(零)。

sourceIndex 大於或等於 的 source容量。 -或-從 開始source的位元組sourceIndex數小count於 。

適用於