共用方式為


WindowsRuntimeBufferExtensions.ToArray 方法

定義

多載

ToArray(IBuffer)

傳回從指定緩衝區內容建立的新陣列 (Windows.Storage.Streams.IBuffer)。 陣列大小是 IBuffer 的 Length 屬性的值。

ToArray(IBuffer, UInt32, Int32)

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

ToArray(IBuffer)

重要

此 API 不符合 CLS 規範。

傳回從指定緩衝區內容建立的新陣列 (Windows.Storage.Streams.IBuffer)。 陣列大小是 IBuffer 的 Length 屬性的值。

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
IBuffer

緩衝區,其內容會填入新陣列。

傳回

Byte[]

位元組陣列,這個陣列包含指定之 IBuffer 中,從位移 0 (零) 開始算起位元組數目等於 IBuffer 之 Length 屬性值的位元組。

屬性

例外狀況

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
IBuffer

緩衝區,其內容會填入新陣列。

sourceIndex
UInt32

開始複製資料的來源 source 中索引。

count
Int32

要複製的位元組數目。

傳回

Byte[]

位元組陣列,其包含指定的位元組範圍。

屬性

例外狀況

source 為 null。

countsourceIndex 小於 0 (零)。

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

適用於