Class DriveInfo
Provides access to information on a drive.
public sealed class DriveInfo
- Inheritance
-
DriveInfo
- Inherited Members
- Extension Methods
Constructors
DriveInfo(string)
Creates a new instance of the DriveInfo class.
public DriveInfo(string driveName)
Parameters
driveName
stringA valid drive letter or fully qualified path.
Remarks
You can't use this constructor to obtain information on drive names that are null or use UNC (\\server\share) paths.
On .NET nanoFramework, this constructor only supports drive letters.
Exceptions
- ArgumentNullException
The drive letter cannot be null.
- ArgumentException
driveName
does not refer to a valid drive.
Properties
DriveType
Gets the drive type, such as removable, fixed or RAM.
public DriveType DriveType { get; set; }
Property Value
- DriveType
One of the enumeration values that specifies a drive type.
Name
Gets the name of a drive, such as C:.
public string Name { get; set; }
Property Value
- string
The name of the drive.
TotalSize
Gets the total size of storage space on a drive, in bytes.
public long TotalSize { get; set; }
Property Value
- long
The total size of the drive, in bytes.
Exceptions
- IOException
An I/O error occurred (for example, a disk error or a drive was not ready).
Methods
Format(string, uint)
Formats the specified drive. *** NOTE THAT THIS OPERATION IS NOT REVERSIBLE ***.
public void Format(string fileSystem, uint parameter)
Parameters
fileSystem
stringFile system to use for the format operation.
parameter
uintA parameter to pass to the format operation.
Remarks
This method is not reversible. Once the drive is formatted, all data on the drive is lost.
This method is implemented in the .NET nanoFramework API but it is not supported on all target devices nor on all file systems.
Exceptions
- NotSupportedException
Thrown when the target doesn't have support for performing the format operation on the specified drive.
- IOException
Thrown when the operation fails.
GetDrives()
Retrieves the drive names of all logical drives on a computer.
public static DriveInfo[] GetDrives()
Returns
GetFileSystems()
Retrieves the names of the file systems available on the connected device.
public static string[] GetFileSystems()
Returns
- string[]
An array of strings that represent the names of the file systems available on the connected device.
MountRemovableVolumes()
Tries to mount all removable volumes.
public static void MountRemovableVolumes()
Remarks
This method is implemented in the .NET nanoFramework API but it is not supported on all target devices.
Refresh()
Refreshes the information about the drive.
public void Refresh()