How do you use DriveInfo to get information about available drives and their free space?
How do you use DriveInfo to get information about available drives and their free space?
IT-Hardware & Networking
Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
You can use the
System.IO.DriveInfoclass in C# to get information about available drives and their properties such as name, type, format, total size, and free space.Example: List All Drives and Their Free Space
🔍 Output Sample (Windows)
Useful Properties of
DriveInfoNameC:\)DriveTypeIsReadyVolumeLabelDriveFormatAvailableFreeSpaceTotalFreeSpaceTotalSize