GetDriveType in C #? or find out if my drive is removable?

I am using Environment.GetLogicalDrives (); for a list of drives. I remember in C ++ I could use GetDriveType to find out if the device was a CD, removable, flash, etc., And I think I want to put a filter in my application to show only CD and removable default. What is the equivalent of GetDriveType in C #? Google just showed me hacks to use C ++ call.

+4
source share
2 answers

Yes, the framework includes the DriveType enumeration used by DriveInfo . Take a look at the GetDrives () method on MSDN.

+8
source

DriveInfo is the class you are looking for.

+3
source

All Articles