Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to get gpt partition information in c# ? like hidden ? attributes ? type ?
Posted

1 solution

Make use of DriveInfo Class :

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    public class Point
    {
        public Double Lat { get; set; }
        public Double Lng { get; set; }
    }
  
    class Program
    {
        static void Main(string[] args)
        {
            DriveInfo[] drives = DriveInfo.GetDrives();
            foreach (DriveInfo drive in drives)
            {             
                Console.WriteLine("Name:{0}",drive.Name);
                if (drive.IsReady)
                {
                    Console.WriteLine("Size:{0}",drive.TotalSize);
                    Console.WriteLine("AvailableFreeSpace:{0}", drive.AvailableFreeSpace);
                    Console.WriteLine("DriveFormat:{0}", drive.DriveFormat);
                    Console.WriteLine("DriveType:{0}", drive.DriveType);
                    Console.WriteLine("TotalFreeSpace:{0}", drive.TotalFreeSpace);
                    Console.WriteLine("VolumeLabel:{0}", drive.VolumeLabel);
                }

                Console.ReadLine();
            }
           
        }

    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900