Aracılığıyla paylaş


FileIO.ReadTextAsync Method

Definition

Overloads

ReadTextAsync(IStorageFile)

Reads the contents of the specified file and returns text.

ReadTextAsync(IStorageFile, UnicodeEncoding)

Reads the contents of the specified file using the specified character encoding and returns text.

ReadTextAsync(IStorageFile)

Reads the contents of the specified file and returns text.

public:
 static IAsyncOperation<Platform::String ^> ^ ReadTextAsync(IStorageFile ^ file);
/// [Windows.Foundation.Metadata.Overload("ReadTextAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> ReadTextAsync(IStorageFile const& file);
[Windows.Foundation.Metadata.Overload("ReadTextAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> ReadTextAsync(IStorageFile file);
function readTextAsync(file)
Public Shared Function ReadTextAsync (file As IStorageFile) As IAsyncOperation(Of String)

Parameters

file
IStorageFile

The file to read.

Returns

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

When this method completes successfully, it returns the contents of the file as a text string.

Attributes

Remarks

Any object that implements the IStorageFile interface may be passed to this method or its overload through the file parameter.

This method uses the character encoding of the specified file. If you want to specify different encoding, call ReadTextAsync(IStorageFile, UnicodeEncoding) instead.

See also

Applies to

ReadTextAsync(IStorageFile, UnicodeEncoding)

Reads the contents of the specified file using the specified character encoding and returns text.

public:
 static IAsyncOperation<Platform::String ^> ^ ReadTextAsync(IStorageFile ^ file, UnicodeEncoding encoding);
/// [Windows.Foundation.Metadata.Overload("ReadTextWithEncodingAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> ReadTextAsync(IStorageFile const& file, UnicodeEncoding const& encoding);
[Windows.Foundation.Metadata.Overload("ReadTextWithEncodingAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> ReadTextAsync(IStorageFile file, UnicodeEncoding encoding);
function readTextAsync(file, encoding)
Public Shared Function ReadTextAsync (file As IStorageFile, encoding As UnicodeEncoding) As IAsyncOperation(Of String)

Parameters

file
IStorageFile

The file to read.

encoding
UnicodeEncoding

The character encoding to use.

Returns

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

When this method completes successfully, it returns the contents of the file as a text string.

Attributes

See also

Applies to