Method WriteAllTextAsync
WriteAllTextAsync(string, string, Encoding?, CancellationToken)
Writes contents to a remote file, creating it or replacing its contents, as
WriteAllTextAsync(string, string, Encoding, CancellationToken) does locally: UTF-8 without a byte order mark
by default; a given encoding writes its preamble (a byte order mark), if it has one.
public Task WriteAllTextAsync(string path, string contents, Encoding? encoding = null, CancellationToken cancellationToken = default)
Parameters
pathstringcontentsstringencodingEncodingcancellationTokenCancellationToken
Returns
Remarks
As WriteAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken): a failure part way leaves the file partly written.