随笔分类 -  Pro C# 2008 and the .NET 3.5 Platform

对照着中文版啃这本书来着。中文版名字《C#与.NET 3.5高级程序设计》
摘要:In fact, the golden rule of .NET memory management is simple:Rule Allocate an object onto the managed heap using the new keyword and forget about it.事实上,在.NET中我们进行内存管理的法则非常简单.l 法则1: 使用new关键字将一个对象分配在托管堆上(对象的引用在栈上),然后就不用再管。Rule If the managed heap does not have sufficient memory to allocate a requeste 阅读全文
posted @ 2012-05-30 19:00 唐小喵 阅读(239) 评论(0) 推荐(0) 编辑
摘要:Throwing a Generic ExceptionWhen you wish to send the error object back to the caller, make use of the C# throw keyword.// This time, throw an exception if the user speeds up beyond MaxSpeed.public void Accelerate(int delta){ if (carIsDead) Console.WriteLine("{0} is out of order...", petNa 阅读全文
posted @ 2012-05-29 23:56 唐小喵 阅读(592) 评论(0) 推荐(0) 编辑
摘要:Speaking of base classes, it is important to keep in mind that the .NET platform demands that a given class have exactly one direct base class.说到基类,要记住很重要的一点:.NET平台要求一个类只能有一个直接基类.While a class can have only one direct base class, it is permissible for an interface to directly derive from multiple in 阅读全文
posted @ 2012-05-29 23:17 唐小喵 阅读(290) 评论(0) 推荐(0) 编辑
摘要:As soon as you define a custom constructor, the default constructor is silently removed from the class and is no longer available!Therefore, if you wish to allow the object user to create an instance of your type with the default constructor, as well as your custom constructor, you must explicitly r 阅读全文
posted @ 2012-05-28 10:20 唐小喵 阅读(390) 评论(0) 推荐(0) 编辑
摘要:Note To avoid any ambiguity, C# demands a method only support a single params argument, which must be the final argument in the parameter list.说明 为了避免歧义,C#要求方法只支持一个params参数,而且必须是参数列表中的最后一个参数.Note Do be aware that if you declare an array, but do not explicitly fill each index, each item will be set t 阅读全文
posted @ 2012-05-21 11:57 唐小喵 阅读(455) 评论(0) 推荐(0) 编辑
摘要:On the Windows operating system, an application’s return value is stored within a system environment variable named %ERRORLEVEL%. If you were to creat... 阅读全文
posted @ 2012-05-19 16:43 唐小喵 阅读(321) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示