摘要: 在C#中,在程序中使用指针(如下面程序所示),编译时会出现“Unsafe code may only appear if compiling with /unsafe”的错误提示。本文谈一下出错原因和解决办法。public static void Main(string[] args) { int i = 99, y = 200; unsafe { swap(&i, &y); } Console.WriteLine("x is now {0},y is now {1}",i,y); } public static u... 阅读全文
posted @ 2013-10-14 13:54 积极的码农 阅读(7957) 评论(0) 推荐(0) 编辑
摘要: [DllImport("kernel32.dll")] public static extern IntPtr _lopen(string lpPathName, int iReadWrite); [DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr hObject); public const int OF_READWRITE = 2; public const int OF_SHARE_DENY_NONE = 0x40; public readonly Int 阅读全文
posted @ 2013-10-14 09:23 积极的码农 阅读(1395) 评论(0) 推荐(0) 编辑