FileIO.ReadTextAsync 方法

定義

多載

ReadTextAsync(IStorageFile)

讀取指定檔案的內容,並傳回文字。

ReadTextAsync(IStorageFile, UnicodeEncoding)

使用指定的字元編碼來讀取指定檔案的內容,並傳回文字。

ReadTextAsync(IStorageFile)

讀取指定檔案的內容,並傳回文字。

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)

參數

file
IStorageFile

要讀取的檔案。

傳回

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

當這個方法成功完成時,它會以文字字串的形式傳回檔案的內容。

屬性

備註

任何實作 IStorageFile 介面的物件都可以透過 file 參數傳遞至此方法或其多載。

這個方法會使用指定檔案的字元編碼。 如果您想要指定不同的編碼方式,請改為呼叫 ReadTextAsync (IStorageFile、UnicodeEncoding)

另請參閱

適用於

ReadTextAsync(IStorageFile, UnicodeEncoding)

使用指定的字元編碼來讀取指定檔案的內容,並傳回文字。

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)

參數

file
IStorageFile

要讀取的檔案。

encoding
UnicodeEncoding

要使用的字元編碼。

傳回

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

當這個方法成功完成時,它會以文字字串的形式傳回檔案的內容。

屬性

另請參閱

適用於