Click or drag to resize
GDFileIOWriteTextAsync Method (IGDStorageFile, String)
Writes text to the specified file.

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public static IAsyncAction WriteTextAsync(
	IGDStorageFile file,
	string contents
)

Parameters

file
Type: GDIGDStorageFile
The file that the text is written to.
contents
Type: SystemString
The text to write.

Return Value

Type: IAsyncAction
No object or value is returned when this method completes.
Examples
The following example shows how to write text to file in the SDK secure storage.
using GD;
...
try
{
    var file = await GDWindows.Instance.SecureFolder.CreateFileAsync("foo.bar");
    if (file != null)
    {
        await GDFileIO.WriteTextAsync(file, "Swift as a shadow");
        // Perform additional tasks after file is written
    }
}
// Handle errors with catch blocks
catch (FileNotFoundException)
{
    // For example, handle file not found
}
See Also