我正在使用WMI的ManagementScope.有一个connect()方法,但没有断开连接方法.我如何断开与ManagementScope的连接?
我尝试使用“使用”选项,但它不是IDisposable,即使我不在范围内,netstat仍然显示我已连接. 最佳答案 看起来你应该更改范围的任何属性,它将被断开连接:
“A scope is disconnected after creation until someone explicitly calls
Connect (), or uses the scope for any operation that requires a live
connection. Also, the scope is disconnected from the previous
connection whenever the identifying properties of the scope are
changed.”
正如我在这里找到的: