System.IO.DriveInfo.GetDrives Method

Retrieves the drive names of all logical drives on a computer.

Syntax

public static DriveInfo[] GetDrives ()

Returns

An array of type System.IO.DriveInfo that represents the logical drives on a computer.

Remarks

This method retrieves all logical drive names on a computer. You can use this information to iterate through the array and obtain information on the drives using other System.IO.DriveInfo methods and properties. Use the DriveInfo.IsReady property to test whether a drive is ready because using this method on a drive that is not ready will throw a System.IO.IOException.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0