Why does
using Microsoft.Win32.SafeHandles
cause the C# Compiler Error:
The type or namespace name 'SafeHandles' does not exist in the namespace 'Microsoft.W开发者_开发知识库in32'
This code is lifted from http://zachsaw.blogspot.com/2010/07/serialport-ioexception-workaround-in-c.html
The problem is that you're trying to use sample code written for the normal .Net Framework in a Compact Framework project. This class is not supported by the CF.
If you want to use a SafeHandle in the Compact Framework, the SDF does include one.
There's no SafeHandles in CF. Check out OpenNetCF
精彩评论