Redigera

Dela via


ByteArrayContent Constructors

Definition

Initializes a new instance of the ByteArrayContent class.

Overloads

ByteArrayContent(Byte[])

Initializes a new instance of the ByteArrayContent class.

ByteArrayContent(Byte[], Int32, Int32)

Initializes a new instance of the ByteArrayContent class.

ByteArrayContent(Byte[])

Source:
ByteArrayContent.cs
Source:
ByteArrayContent.cs
Source:
ByteArrayContent.cs

Initializes a new instance of the ByteArrayContent class.

public:
 ByteArrayContent(cli::array <System::Byte> ^ content);
public ByteArrayContent (byte[] content);
new System.Net.Http.ByteArrayContent : byte[] -> System.Net.Http.ByteArrayContent
Public Sub New (content As Byte())

Parameters

content
Byte[]

The content used to initialize the ByteArrayContent.

Exceptions

The content parameter is null.

Remarks

The ByteArrayContent class does not internally copy the provided byte array but keeps a reference to it instead. Callers should not modify the data in the array until after the content is sent.

Applies to

ByteArrayContent(Byte[], Int32, Int32)

Source:
ByteArrayContent.cs
Source:
ByteArrayContent.cs
Source:
ByteArrayContent.cs

Initializes a new instance of the ByteArrayContent class.

public:
 ByteArrayContent(cli::array <System::Byte> ^ content, int offset, int count);
public ByteArrayContent (byte[] content, int offset, int count);
new System.Net.Http.ByteArrayContent : byte[] * int * int -> System.Net.Http.ByteArrayContent
Public Sub New (content As Byte(), offset As Integer, count As Integer)

Parameters

content
Byte[]

The content used to initialize the ByteArrayContent.

offset
Int32

The offset, in bytes, in the content parameter used to initialize the ByteArrayContent.

count
Int32

The number of bytes in the content starting from the offset parameter used to initialize the ByteArrayContent.

Exceptions

The content parameter is null.

The offset parameter is less than zero.

-or-

The offset parameter is greater than the length of content specified by the content parameter.

-or-

The count parameter is less than zero.

-or-

The count parameter is greater than the length of content specified by the content parameter - minus the offset parameter.

Remarks

The ByteArrayContent class does not internally copy the provided byte array but keeps a reference to it instead. Callers should not modify the data in the array until after the content is sent.

Only the range specified by the offset parameter and the count parameter is used as content.

Applies to