Click or drag to resize

ExtensionsDirectoryInfoCreateFileAsync Method (DirectoryInfo, String, CreationCollisionOption)

Creates a new file in the current folder. This method also specifies what to do if a file with the same name already exists in the current folder.

Namespace:  Cauldron
Assembly:  Cauldron (in Cauldron.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static Task<FileInfo> CreateFileAsync(
	this DirectoryInfo directoryInfo,
	string desiredName,
	CreationCollisionOption options
)

Parameters

directoryInfo
Type: System.IODirectoryInfo
The DirectoryInfo representing the current folder
desiredName
Type: SystemString
The name of the new file to create in the current folder.
options
Type: CauldronCreationCollisionOption
One of the enumeration values that determines how to handle the collision if a file with the specified desiredName already exists in the current folder.

Return Value

Type: TaskFileInfo
When this method completes, it returns a FileInfo that represents the new file.>

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DirectoryInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptiondesiredName is null
ArgumentExceptiondesiredName is empty
IOExceptionIf file already exists. Only on FailIfExists
See Also