Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IsReady Property

DriveInfo::IsReady Property

Gets a value that indicates whether a drive is ready.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

public:
property bool IsReady {
	bool get ();
}

Property Value

Type: System::Boolean
true if the drive is ready; false if the drive is not ready.

IsReady indicates whether a drive is ready. For example, it indicates whether a CD is in a CD drive or whether a removable storage device is ready for read/write operations. If you do not test whether a drive is ready, and it is not ready, querying the drive using DriveInfo will raise an IOException.

Do not rely on IsReady to avoid catching exceptions from other members such as TotalSize, TotalFreeSpace, and DriveFormat. Between the time that your code checks IsReady and then accesses one of the other properties (even if the access occurs immediately after the check), a drive may have been disconnected or a disk may have been removed.

The following code example demonstrates the use of the DriveInfo class to display information about all of the drives on the current system.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft