| GDStorageFolderGetFileAsync Method |
Gets the specified file from the current folder.
Namespace:
GD
Assembly:
GD (in GD.dll) Version: 255.255.255.255
Syntax public IAsyncOperation<GDStorageFile> GetFileAsync(
string name
)
public:
virtual IAsyncOperation<GDStorageFile^>^ GetFileAsync(
[InAttribute] String^ name
) sealed
function GetFileAsync(name);
Parameters
- name
- Type: SystemString
The name (or path relative to the current folder) of the file to retrieve.
Return Value
Type:
IAsyncOperationGDStorageFileWhen this method completes successfully, it returns a
GDStorageFile that represents the file.
Implements
IGDStorageFolderGetFileAsync(String)Exceptions Exception | Condition |
---|
Exception | (C# equivalent: System.IO.FileNotFoundException) The specified file does not exist. Check the value of name. |
AccessDeniedException | (C# equivalent: System.UnauthorizedAccessException) Secure storage was remotely wiped. |
InvalidArgumentException | (C# equivalent: System.ArgumentException) The path contains invalid characters, or the format of the path is incorrect. Check the value of name. |
Remarks Examples
The following example shows how to get a file from the current folder by calling the
GetFileAsync(String) method. This example also shows how to get a file from a subfolder of the current folder by providing a relative path.
using GD;
GDStorageFolder rootFolder = GDWindows.Instance.SecureFolder;
GDStorageFile fooFile = await rootFolder.GetFileAsync("foo.txt");
GDStorageFile barFile = await rootFolder.GetFileAsync(@"subdir\bar.txt");
See Also