为什么
使用 Microsoft.Win32.SafeHandles
导致 C# 编译器错误:
The type or namespace name 'SafeHandles' does not exist in the namespace 'Microsoft.Win32'
此代码取自 http://zachsaw.blogspot.com/2010/07/serialport-ioexception-workaround-in-c.html
最佳答案
问题是您试图在 Compact Framework 项目中使用为普通 .Net Framework 编写的示例代码。 CF 不支持此类。
关于C#:如何使用 Microsoft.Win32.SafeHandles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4490148/