FileIO.WriteTextAsync Method

Definition

Overloads

WriteTextAsync(IStorageFile, String)

Writes text to the specified file.

WriteTextAsync(IStorageFile, String, UnicodeEncoding)

Writes text to the specified file using the specified character encoding.

WriteTextAsync(IStorageFile, String)

Writes text to the specified file.

public:
 static IAsyncAction ^ WriteTextAsync(IStorageFile ^ file, Platform::String ^ contents);
 static IAsyncAction WriteTextAsync(IStorageFile const & file, winrt::hstring const & contents);
[Windows.Foundation.Metadata.Overload("WriteTextAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction WriteTextAsync(IStorageFile file, string contents);
function writeTextAsync(file, contents)
Public Shared Function WriteTextAsync (file As IStorageFile, contents As String) As IAsyncAction

Parameters

file
IStorageFile

The file that the text is written to.

contents
String

The text to write.

Returns

IAsyncAction

No object or value is returned when this method completes.

Attributes

Remarks

This method attempts to automatically detect the encoding of a file based on the presence of byte order marks. If an encoding cannot be detected, the encoding specified by the caller is used.

See also

WriteTextAsync(IStorageFile, String, UnicodeEncoding)

Writes text to the specified file using the specified character encoding.

public:
 static IAsyncAction ^ WriteTextAsync(IStorageFile ^ file, Platform::String ^ contents, UnicodeEncoding encoding);
 static IAsyncAction WriteTextAsync(IStorageFile const & file, winrt::hstring const & contents, UnicodeEncoding encoding);
[Windows.Foundation.Metadata.Overload("WriteTextWithEncodingAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction WriteTextAsync(IStorageFile file, string contents, UnicodeEncoding encoding);
function writeTextAsync(file, contents, encoding)
Public Shared Function WriteTextAsync (file As IStorageFile, contents As String, encoding As UnicodeEncoding) As IAsyncAction

Parameters

file
IStorageFile

The file that the text is written to.

contents
String

The text to write.

encoding
UnicodeEncoding

The character encoding of the file.

Returns

IAsyncAction

No object or value is returned when this method completes.

Attributes

See also

Applies to