Dela via


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);
/// [Windows.Foundation.Metadata.Overload("WriteTextAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 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

Platform::String

winrt::hstring

The text to write.

Returns

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

Applies to

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);
/// [Windows.Foundation.Metadata.Overload("WriteTextWithEncodingAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncAction WriteTextAsync(IStorageFile const& file, winrt::hstring const& contents, UnicodeEncoding const& 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

Platform::String

winrt::hstring

The text to write.

encoding
UnicodeEncoding

The character encoding of the file.

Returns

No object or value is returned when this method completes.

Attributes

See also

Applies to