संपादित करें

इसके माध्यम से साझा किया गया


File.AppendAllBytesAsync Method

Definition

Overloads

AppendAllBytesAsync(String, Byte[], CancellationToken)

Asynchronously appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file. If the operation is canceled, the task will return in a canceled state.

AppendAllBytesAsync(String, ReadOnlyMemory<Byte>, CancellationToken)

Asynchronously appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file. If the operation is canceled, the task will return in a canceled state.

AppendAllBytesAsync(String, Byte[], CancellationToken)

Source:
File.cs

Asynchronously appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file. If the operation is canceled, the task will return in a canceled state.

public static System.Threading.Tasks.Task AppendAllBytesAsync (string path, byte[] bytes, System.Threading.CancellationToken cancellationToken = default);
static member AppendAllBytesAsync : string * byte[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function AppendAllBytesAsync (path As String, bytes As Byte(), Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

path
String

The file to append to.

bytes
Byte[]

The bytes to append to the file.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous append operation.

Exceptions

path or bytes is null.

path is empty.

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

Applies to

AppendAllBytesAsync(String, ReadOnlyMemory<Byte>, CancellationToken)

Asynchronously appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file. If the operation is canceled, the task will return in a canceled state.

public static System.Threading.Tasks.Task AppendAllBytesAsync (string path, ReadOnlyMemory<byte> bytes, System.Threading.CancellationToken cancellationToken = default);
static member AppendAllBytesAsync : string * ReadOnlyMemory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function AppendAllBytesAsync (path As String, bytes As ReadOnlyMemory(Of Byte), Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

path
String

The file to append to.

bytes
ReadOnlyMemory<Byte>

The bytes to append to the file.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous append operation.

Exceptions

path is null.

path is empty.

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

Applies to