DriveInfo::TotalSize Property


Gets the total size of storage space on a drive, in bytes.

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

property long long TotalSize {
	long long get();

Property Value

Type: System::Int64

The total size of the drive, in bytes.

Exception Condition

Access to the drive information is denied.


The drive is not mapped or does not exist.


An I/O error occurred (for example, a disk error or a drive was not ready).

This property indicates the total size of the drive in bytes, not just what is available to the current user.

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
Available since 2.0
Return to top