本文介绍了GetDriveType在C#中?或者看看我的硬盘是可移动的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Environment.GetLogicalDrives();以获得驱动器的列表。我记得在C ++中我可以使用GetDriveType找到,如果该设备是CD,可移动,闪光灯等,我想我想提出一个过滤器在我的应用程序只显示CD和可移动的默认值。什么是GetDriveType相当于在C#中? 。谷歌只显示我的黑客使用C ++调用

I am using Environment.GetLogicalDrives(); to get a list of drives. I remember in c++ i could use GetDriveType to find if the device was CD, removable, flash, etc and i am thinking i want to put a filter in my app to only show CD and removable on default. What is the GetDriveType equivalent in C#? google only showed me hacks to use the c++ call.

推荐答案

是,该框架包括的枚举由的类。看一看在方法。

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

这篇关于GetDriveType在C#中?或者看看我的硬盘是可移动的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 23:21