WindowsRuntimeBuffer.Create 方法

定義

多載

名稱 Description
Create(Int32)

回傳一個空的 Windows。Storage.Streams.IBuffer 介面,具備指定的最大容量。

Create(Byte[], Int32, Int32, Int32)

退回一台 Windows。Storage.Streams.IBuffer 介面,包含從位元組陣列複製的指定位元組範圍。 若指定容量大於複製的位元組數,緩衝區其餘部分將被填為零。

Create(Int32)

重要

此 API 不符合 CLS 規範。

回傳一個空的 Windows。Storage.Streams.IBuffer 介面,具備指定的最大容量。

public:
 static Windows::Storage::Streams::IBuffer ^ Create(int capacity);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer Create(int capacity);
[<System.CLSCompliant(false)>]
static member Create : int -> Windows.Storage.Streams.IBuffer
Public Shared Function Create (capacity As Integer) As IBuffer

參數

capacity
Int32

緩衝區可容納的最大位元組數。

傳回

Windows.Storage.Streams.IBuffer

一台 Windows。Storage.Streams.IBuffer 介面,具有指定容量且長度屬性為 0(零)。

屬性

例外狀況

capacity 小於0(零)。

適用於

Create(Byte[], Int32, Int32, Int32)

重要

此 API 不符合 CLS 規範。

退回一台 Windows。Storage.Streams.IBuffer 介面,包含從位元組陣列複製的指定位元組範圍。 若指定容量大於複製的位元組數,緩衝區其餘部分將被填為零。

public:
 static Windows::Storage::Streams::IBuffer ^ Create(cli::array <System::Byte> ^ data, int offset, int length, int capacity);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer Create(byte[] data, int offset, int length, int capacity);
[<System.CLSCompliant(false)>]
static member Create : byte[] * int * int * int -> Windows.Storage.Streams.IBuffer
Public Shared Function Create (data As Byte(), offset As Integer, length As Integer, capacity As Integer) As IBuffer

參數

data
Byte[]

要複製的位元組陣列。

offset
Int32

就是複製開始的偏移 data 量。

length
Int32

要複製的位元組數。

capacity
Int32

緩衝區可容納的最大位元組數;若此值大於 length,緩衝區中其餘位元組將初始化為 0(0)。

傳回

Windows.Storage.Streams.IBuffer

一台 Windows。包含指定位元組範圍的 Storage.Streams.IBuffer 介面。 若 capacity 大於 length,其餘緩衝區為零填充。

屬性

例外狀況

capacityoffset, 或 length 小於0(零)。

data 為 null。

從 開始 offsetdata 包含 length 元素。 -或-從 開始 offsetdata 包含 capacity 元素。

適用於