Saturday, 2 December 2017

C# Program to List Disk Drives


Code:

using System;
using System.IO;
class Test
{
    public static void Main()
    {
        DriveInfo[] driverslist = DriveInfo.GetDrives();
        foreach (DriveInfo d in driverslist)
        {
            Console.WriteLine("Drive {0}", d.Name);
            Console.WriteLine("  File type: {0}", d.DriveType);
            if (d.IsReady == true)
            {
                Console.WriteLine(" Total size of drive:{0, 15} bytes ",d.TotalSize);
                Console.Read();
            }
        }
    }
}


Output:

Drive C:\
File Type : Fixed
Total Size of Drive : 107268272128


More C# Programs:



















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...