PathIO.ReadTextAsync Méthode

Définition

Surcharges

ReadTextAsync(String)

Lit le contenu du fichier au niveau du chemin d’accès ou de l’URI (Uniform Resource Identifier) spécifié et retourne le texte.

ReadTextAsync(String, UnicodeEncoding)

Lit le contenu du fichier au niveau du chemin d’accès ou de l’URI (Uniform Resource Identifier) spécifié à l’aide de l’encodage de caractères spécifié et retourne du texte.

ReadTextAsync(String)

Lit le contenu du fichier au niveau du chemin d’accès ou de l’URI (Uniform Resource Identifier) spécifié et retourne le texte.

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

Paramètres

absolutePath
String

Platform::String

winrt::hstring

Chemin du fichier à lire.

Retours

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

Une fois cette méthode terminée, elle retourne le contenu du fichier sous forme de chaîne de texte.

Attributs

Exemples

Cet exemple vous montre comment utiliser readTextAsync(absolutePath) pour lire le texte du fichier au niveau du chemin d’accès, absoluteFilePath comme suit :

Windows.Storage.PathIO.readTextAsync(absoluteFilePath).then(function (contents) {
    // Add code to process the text read from the file
});

Vous pouvez utiliser ensuite ou effectuer pour déclarer une fonction pour capturer et traiter le texte lu à partir du fichier. Une fois la méthode readTextAsync terminée, le texte est passé à cette fonction en tant qu’objet string (contents dans l’exemple).

Voir aussi

S’applique à

ReadTextAsync(String, UnicodeEncoding)

Lit le contenu du fichier au niveau du chemin d’accès ou de l’URI (Uniform Resource Identifier) spécifié à l’aide de l’encodage de caractères spécifié et retourne du texte.

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

Paramètres

absolutePath
String

Platform::String

winrt::hstring

Chemin du fichier à lire.

encoding
UnicodeEncoding

Encodage de caractères du fichier.

Retours

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

Une fois cette méthode terminée, elle retourne le contenu du fichier sous forme de chaîne de texte.

Attributs

Voir aussi

S’applique à