05 2012 档案
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:On the Windows operating system, an application’s return value is stored within a system environment variable named %ERRORLEVEL%. If you were to creat...
阅读全文
摘要:1. 数据:是描述客观事物的符号,是计算机中可以操作的对象,是能被计算机识别,并输入给计算机处理的符号集合。2. 数据元素:是组成数据的、有一定意义的基本单位,在计算机中通常作为整体处理。也被称为记录。3. 数据项:一个数据元素可以由若干个数据项组成。数据项是数据不可分割的最小单位。4. 数据对象:是性质相同的数据元素的集合,是数据的子集。5. 数据结构:是相互之间存在的一种或多种特定关系的数据元素的集合。6. 逻辑结构与物理结构: 6.1 逻辑结构:是指数据对象中数据元素之间的相互关系。 6.1.1 集合结构: 集合结构中的数据元素除了同属于一个集合外,它们直接没有其他关系。 ...
阅读全文