FileIO.ReadTextAsync(IStorageFile) | readTextAsync(IStorageFile) method
Reads the contents of the specified file and returns text.
The file to read.
When this method completes successfully, it returns the contents of the file as a text string.
Any object that implements the IStorageFile interface may be passed to this method 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.
The File Access sample shows you how to use readTextAsync(file) to read text from a file, like this:
In the example,
file is a local variable that contains a storageFile that represents the file to read.
After readTextAsync completes, the
fileContent variable gets the contents of the file as a text string. You can then process the contents as appropriate.
Minimum supported client
Minimum supported server
|Windows Server 2012|
Build date: 11/16/2013