Dela via


IStorageFolder.CreateFileAsync Method

Definition

Overloads

CreateFileAsync(String)

Creates a new file in the current folder.

CreateFileAsync(String, CreationCollisionOption)

Creates a new file in the current folder, and specifies what to do if a file with the same name already exists in the current folder.

CreateFileAsync(String)

Creates a new file in the current folder.

public:
 IAsyncOperation<StorageFile ^> ^ CreateFileAsync(Platform::String ^ desiredName);
/// [Windows.Foundation.Metadata.Overload("CreateFileAsyncOverloadDefaultOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageFile> CreateFileAsync(winrt::hstring const& desiredName);
[Windows.Foundation.Metadata.Overload("CreateFileAsyncOverloadDefaultOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageFile> CreateFileAsync(string desiredName);
function createFileAsync(desiredName)
Public Function CreateFileAsync (desiredName As String) As IAsyncOperation(Of StorageFile)

Parameters

desiredName
String

Platform::String

winrt::hstring

The desired name of the file to create.

Returns

When this method completes, it returns the new file as a StorageFile.

Attributes

See also

Applies to

CreateFileAsync(String, CreationCollisionOption)

Creates a new file in the current folder, and specifies what to do if a file with the same name already exists in the current folder.

public:
 IAsyncOperation<StorageFile ^> ^ CreateFileAsync(Platform::String ^ desiredName, CreationCollisionOption options);
/// [Windows.Foundation.Metadata.Overload("CreateFileAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageFile> CreateFileAsync(winrt::hstring const& desiredName, CreationCollisionOption const& options);
[Windows.Foundation.Metadata.Overload("CreateFileAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageFile> CreateFileAsync(string desiredName, CreationCollisionOption options);
function createFileAsync(desiredName, options)
Public Function CreateFileAsync (desiredName As String, options As CreationCollisionOption) As IAsyncOperation(Of StorageFile)

Parameters

desiredName
String

Platform::String

winrt::hstring

The desired name of the file to create.

If there is an existing file in the current folder that already has the specified desiredName, the specified CreationCollisionOption determines how Windows responds to the conflict.

options
CreationCollisionOption

The enum value that determines how Windows responds if the desiredName is the same as the name of an existing file in the current folder.

Returns

When this method completes, it returns the new file as a StorageFile.

Attributes

See also

Applies to