C# 获得设备usb信息
原文: C# 获得设备usb信息 本文告诉大家如何获得设备的usb来进行判断是否有哪些usb和找不到usb可能是什么。 需要在项目右击引用,点击程序集,搜索 System.Management 然后安装他 然后使用下面的代码就可以获得设备的 usb 请看代码 static List<(string DeviceID, string PNPDeviceID, string Description)> GetUSBDevices() { List<(string DeviceID, string PNPDeviceID, string Description)> devices = new List<(string, string, string)>(); ManagementObjectCollection collection; using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub")) { collection = searcher.Get()...

