File.WriteAllBytesAsync(String, Byte[], CancellationToken) File.WriteAllBytesAsync(String, Byte[], CancellationToken) Method

Definition

Asynchronously creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.

public static System.Threading.Tasks.Task WriteAllBytesAsync (string path, byte[] bytes, System.Threading.CancellationToken cancellationToken = null);
static member WriteAllBytesAsync : string * byte[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

path
String String

The file to write to.

bytes
Byte[]

The bytes to write to the file.

cancellationToken
CancellationToken CancellationToken

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

Returns

A task that represents the asynchronous write operation.

Applies to