HttpContent.LoadIntoBufferAsync Method

Definition

Serialize the HTTP content to a memory buffer as an asynchronous operation.

Overloads

LoadIntoBufferAsync(Int64, CancellationToken)

Serialize the HTTP content to a memory buffer as an asynchronous operation.

LoadIntoBufferAsync(CancellationToken)

Serialize the HTTP content to a memory buffer as an asynchronous operation.

LoadIntoBufferAsync(Int64)

Serialize the HTTP content to a memory buffer as an asynchronous operation.

LoadIntoBufferAsync()

Serialize the HTTP content to a memory buffer as an asynchronous operation.

Remarks

This operation will not block.

LoadIntoBufferAsync(Int64, CancellationToken)

Serialize the HTTP content to a memory buffer as an asynchronous operation.

C#
public System.Threading.Tasks.Task LoadIntoBufferAsync(long maxBufferSize, System.Threading.CancellationToken cancellationToken);

Parameters

maxBufferSize
Int64

The maximum size, in bytes, of the buffer to use.

cancellationToken
CancellationToken

The cancellation token to cancel the operation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

The object has already been disposed.

Remarks

This operation will not block. The returned Task object will complete after all of the content has been serialized to the memory buffer.

After content is serialized to a memory buffer, calls to one of the CopyToAsync(Stream) methods will copy the content of the memory buffer to the target stream.

Applies to

.NET 10 and .NET 9
Product Versions
.NET 9, 10

LoadIntoBufferAsync(CancellationToken)

Serialize the HTTP content to a memory buffer as an asynchronous operation.

C#
public System.Threading.Tasks.Task LoadIntoBufferAsync(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken
CancellationToken

The cancellation token to cancel the operation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

The object has already been disposed.

Remarks

This operation will not block. The returned Task object will complete after all of the content has been serialized to the memory buffer.

After content is serialized to a memory buffer, calls to one of the CopyToAsync(Stream) methods will copy the content of the memory buffer to the target stream.

Applies to

.NET 10 and .NET 9
Product Versions
.NET 9, 10

LoadIntoBufferAsync(Int64)

Source:
HttpContent.cs
Source:
HttpContent.cs
Source:
HttpContent.cs

Serialize the HTTP content to a memory buffer as an asynchronous operation.

C#
public System.Threading.Tasks.Task LoadIntoBufferAsync(long maxBufferSize);

Parameters

maxBufferSize
Int64

The maximum size, in bytes, of the buffer to use.

Returns

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task object will complete after all of the content has been serialized to the memory buffer.

After content is serialized to a memory buffer, calls to one of the CopyToAsync methods will copy the content of the memory buffer to the target stream.

If the content exceeds the value passed in the maxBufferSize parameter, an exception is thrown.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

LoadIntoBufferAsync()

Source:
HttpContent.cs
Source:
HttpContent.cs
Source:
HttpContent.cs

Serialize the HTTP content to a memory buffer as an asynchronous operation.

C#
public System.Threading.Tasks.Task LoadIntoBufferAsync();

Returns

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task object will complete after all of the content has been serialized to the memory buffer.

After content is serialized to a memory buffer, calls to one of the CopyToAsync methods will copy the content of the memory buffer to the target stream.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0