Provides access to information on a drive.
| C# | Visual Basic |
public sealed class DriveInfo
Public NotInheritable Class DriveInfo
| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description |
|---|---|---|
| DriveInfo(String) |
Provides access to information on the specified drive.
| |
| AvailableFreeSpace |
Indicates the amount of available free space on a drive.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) | |
| GetDrives()()()() |
Retrieves the drive names of all logical drives on a device.
| |
| GetHashCode()()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
| GetType()()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
| MemberwiseClone()()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
| RootDirectory |
Gets the root directory of a drive.
| |
| ToString()()()() |
Returns a drive name as a string.
(Overrides Object.ToString()()()().) | |
| TotalFreeSpace |
Gets the total amount of free space available on a drive.
| |
| TotalSize |
Gets the total size of storage space on a drive.
|
Equivalent to System.IO.DriveInfo
This class models a drive and provides methods and properties to query for drive information. Use DriveInfo to determine what drives are available, and the capacity and available free space on the drive.The following code example demonstrates the use of the DriveInfo class to display information about all of the drives on the current system
CopyVB.NET
Imports System Imports System.IO Class Test Public Shared Sub Main() Dim allDrives() As DriveInfo = DriveInfo.GetDrives() Dim d As DriveInfo For Each d In allDrives Debug.WriteLine("Drive {0}", d.Name) Debug.WriteLine(" Available space to current user:{0, 15} bytes", _ d.AvailableFreeSpace) Debug.WriteLine(" Total available space: {0, 15} bytes", _ d.TotalFreeSpace) Debug.WriteLine(" Total size of drive: {0, 15} bytes ", _ d.TotalSize) Next End Sub End Class 'This code produces output similar to the following: ' 'Drive \ ' Available space to current user: 4770430976 bytes ' Total available space: 4770430976 bytes ' Total size of drive: 10731683840 bytes 'Drive \Storage Card ' Available space to current user: 15114977280 bytes ' Total available space: 15114977280 bytes ' Total size of drive: 25958948864 bytes ' 'The actual output of this code will vary based on machine and the permissions 'granted to the user executing it.
| Object | |
| DriveInfo | |