C# Programming Language学习笔记(三)

第二章 词法结构
The lexical grammar defines how Unicode characters are combined to form line terminators, white space, comments, tokens, and preprocessing directives. The syntactic grammar defines how the tokens resulting from the lexical grammar are combined to form C# programs.
词法分析定义如何把Unicode字符联合形成行,空白符,注释,标记和预处理.语法分析定义如何把从词法分析中得到的标记联合形成C#程序.
词法分析还是比较麻烦的一部分,等日后看编译原理的时候再回来瞧瞧.
第三章 基础概念
1.An application domain enables application isolation by acting as a container for application state. An application domain acts as a container and boundary for the types defined in the application and the class libraries it uses. Types loaded into one application domain are distinct from the same type loaded into another application domain, and instances of objects are not directly shared between application domains. For instance, each application domain has its own copy of static variables for these types, and a static constructor for a type runs at most once per application domain. Implementations are free to provide implementation-specific policy or mechanisms for creating and destroying application domains.
程序域作为应用程序的状态容器把程序隔离.程序域是程序中定义类型和使用的类库的容器和边界.加载到一个程序域中的类型区别与加载到另一程序域的同一类型,并且对象的实例在程序域间不能直接共享.比如,每一个程序域都有它们类型的静态变量的拷贝,并且一个类型的静态构造器在程序域中至多只能运行一次.执行为创建和销毁程序域自动提供具体的执行策略和机制.
2.Because C# supports method overloading, a class or struct can contain multiple definitions of some method, provided each has a different signature. However, within a single program, no class or struct can contain more than one method called Main whose definition qualifies it to be used as an application entry point. Other overloaded versions of Main are permitted, however, provided they have more than one parameter or their only parameter is other than type string[].
C#支持方法重载,一个类或结构可以包含一些方法的多次定义,只要具有不同的签名.但是,在一个单独的程序中,没有类和结构能够包含多于一个的定义为用来作程序入口的称为Main的方法.其它重载版本的Main方法是允许的,但是,要保证它们要多于一个参数或者有一个参数,但类型不是string[].
3. Specifically, the execution environment can access the application's entry point regardless of its declared accessibility and regardless of the declared accessibility of its enclosing type declarations.
比较特殊的,执行环境总是可以访问程序的入口,不管入口声明的访问级别也不管入口所属类型的访问级别是什么.
4.Prior to an application's termination, destructors for all of its objects that have not yet been garbage collected are called, unless such cleanup has been suppressed (by a call to the library method GC.SuppressFinalize, for example).
在程序终止之前,程序中所有没有被垃圾回收器收集的对象的析构器会被调用,除非这些清理已经被强制执行过(比如,调用库方法GC.SuppressFinalize).

原文地址:https://www.cnblogs.com/Farseer1215/p/258022.html