Click or drag to resize

ExtensionsDirectoryInfoToFileInfo Method

Converts a string to a FileInfo

Namespace:  Cauldron
Assembly:  Cauldron (in Cauldron.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static FileInfo ToFileInfo(
	this DirectoryInfo directoryInfo,
	string filename
)

Parameters

directoryInfo
Type: System.IODirectoryInfo
The DirectoryInfo representing the current folder
filename
Type: SystemString
The fully qualified name of the new file, or the relative file name. Do not end the path with the directory separator character.

Return Value

Type: FileInfo
An instance of FileInfo

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
ArgumentNullExceptionfilename is null.
SecurityExceptionThe caller does not have the required permission.
ArgumentException The file name is empty, contains only white spaces, or contains invalid characters.
UnauthorizedAccessExceptionAccess to fileName is denied.
PathTooLongException The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
UnauthorizedAccessExceptionfilename contains a colon (:) in the middle of the string.
See Also