Angelo Lee's Blog
This is my kingdom .If i don't fight for it ,who will ?
摘要: IntroductionBack when I started using XML documents in C++, parsing and getting data out of the document was not what I would have called friendly, nor was generating a new document from scratch. Around that time, I also started playing with this new language called C#. At some point, I was doing XM 阅读全文
posted @ 2011-01-05 14:39 Angelo Lee 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 为了保持类型安全,默认情况下,C# 不支持指针算法。 不过,通过使用 unsafe 关键字,可以定义可使用指针的不安全上下文。unsafe在C#程序中的使用场合:1)实时应用,采用指针来提高性能;2)引用非.net DLL提供的如C++编写的外部函数,需要指针来传递该函数;3)调试,用以检测程序在运行过程中的内存使用状况。使用unsafe的利弊:好处:性能和灵活性提高;可以调用其他dll的函数,提高了兼容性;可以得到内存地址;坏处:非法修改了某些变量;内存泄漏。unsafe与unmanaged的区别:managed code是在CLR监管下运行的程序。以下任务由CLR来执行:... 阅读全文
posted @ 2011-01-05 13:55 Angelo Lee 阅读(977) 评论(0) 推荐(0) 编辑