GDStorageFolderCreateFileAsync Method (String) |
Namespace: GD
public IAsyncOperation<GDStorageFile> CreateFileAsync( string desiredName )
Exception | Condition |
---|---|
Exception | A file with the specified desiredName already exists in the current folder or some unexpected error occurred. |
AccessDeniedException | Secure storage was remotely wiped. |
InvalidArgumentException | The format of the filename is incorrect. Check the value of desiredName. |
This method uses the FailIfExists value from the CreationCollisionOption enumeration by default. That is, this method raises an exception if a file with the same name already exists in the current folder. If you want to handle a file name collision in a different way, call the CreateFileAsync(String, CreationCollisionOption) method.
If you try to create a file in a folder that represents a container for a group of files (for example, the return value from some overloads of the GetFoldersAsync method), the CreateFileAsync(String) method may fail.
Note: No leading nor trailing spaces are stripped from desiredName.
using GD; var secureFile = await GDWindows.Instance.SecureFolder.CreateFileAsync("sample.txt");