How to get the list of removable disk in c#?

后端 未结 3 1096
深忆病人
深忆病人 2020-12-31 03:44

I want to get the list of removable disk in c#. I want to skip the local drives. Because i want the user to save the file only in removable disk.

3条回答
  •  一个人的身影
    2020-12-31 04:10

    How about:

    var removableDrives = from d in System.IO.DriveInfo.GetDrives()
                          where d.DriveType == DriveType.Removable;
    

提交回复
热议问题