Method GetDriveLetter
GetDriveLetter(FileSystemInfo)
Gets the drive letter from a given FileSystemInfo object.
Declaration
public static string GetDriveLetter(this FileSystemInfo file)
Parameters
Type | Name | Description |
---|---|---|
FileSystemInfo | file | The FileSystemInfo object to extract the drive letter from. |
Returns
Type | Description |
---|---|
string | The drive letter of the file system object. Returns null if the path is not rooted. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the input file system object is null. |
ArgumentException | Thrown if the file system object does not have a rooted path. |