2..net基础学习
----------------------
库开发人员在创建命名空间的名称时应使用以下原则:“公司名称.技术名称”----------------------
利用命名模式将相关类型分组为命名空间是生成和记录类库的一种非常有用的方式。但是,此命名方案对可见性、成员访问、继承、安全性或绑定无效。一个命名空间可以被划分在多个程序集中,而单个程序集可以包含来自多个命名空间的类型。程序集为公共语言运行库中的版本控制、部署、安全性、加载和可见性提供外形结构。
----------------------
系统命名空间
System 命名空间是 .NET Framework 中基本类型的根命名空间。此命名空间包括表示由所有应用程序使用的基础数据类型的类:Object(继承层次结构的根)、Byte、Char、Array、Int32、String 等。在这些类型中,有许多与编程语言所使用的基元数据类型相对应。当使用 .NET Framework 类型编写代码时,可以在应使用 .NET Framework 基础数据类型时使用编程语言的相应关键字。
----------------------
Other Files Used to Build Applications
 
In addition to source-code modules, Borland products use several non-Pascal files to build applications. These files are maintained automatically by the IDE, and include
 
VCL form files (which have a .dfm extension on Win32, and .nfm on .NET) 
Resource files (which end with .res) 
Project options files (which end with .dof ) 
----------------------
dpu 
----------------------
you use the GD switch, the linker generates a map file and a .drc file; the .drc file, which contains string resources, can be compiled into a resource file.
----------------------
unit Unit1;
     
interfaceprocedure PrintMessage(msg: string);implementation;procedure PrintMessage(msg: string);
begin
   Writeln(msg);
end;end.
----------------------
You can now compile Greeting from the command line by entering
 
dcc32 greeting 
to produce a Win32 executable, or
 
dccil greeting 
to produce a managed .NET executable.
----------------------
In standard Pascal, a program heading can include parameters after the program name:
 
[Delphi] program Calc(input, output);
Borland's Delphi ignores these parameters.
 
In Delphi 2005, a the program heading introduces its own namespace, which is called the project default namespace. This is also true for the library and package headers, when these types of projects are compiled for the .NET platform.
----------------------
 The block can also contain declarations of constants, types, variables, procedures, and functions; these declarations must precede the statement part of the block
----------------------
In Delphi, a unit is the basic container for types. Microsoft's Common Language Runtime (CLR) introduces another layer of organization called a namespace. In the .NET Framework, a namespace is a conceptual container of types. In Delphi, a namespace is a container of Delphi units. The addition of namespaces gives Delphi the ability to access and extend classes in the .NET Framework. 
----------------------
A namespace search example
 
The following example project and unit files use the namespace clause to establish a namespace search list: 
// Project file declarations...
program MyCompany.Programs.MyProgram;
namespaces MyCompany.Libs.UIWidgets, MyCompany.Libs.Network;
// Unit source file declaration...
unit MyCompany.Programs.Units.MyUnit1;
Given this program example, the compiler would search namespaces in the following order:
 
MyCompany.Programs.Units 
MyCompany.Programs 
MyCompany.Libs.Network 
MyCompany.Libs.UIWidgets 
Namespaces specified by compiler options. 
----------------------
A project file (program, library or package) may optionally specify a list of namespaces to be searched when resolving generic unit names. The namespaces clause must appear in the project file, immediately after the program, library, or package declaration and before any other clause or block type. The namespaces clause is a list of namespace identifiers, separated by commas. A semicolon must terminate the list of namespaces. 
The compiler resolves identifier names in the following order: 
The current unit namespace (if any) 
The project default namespace (if any) 
Namespaces specified by compiler options. 
A namespace search example
 
The following example project and unit files use the namespace clause to establish a namespace search list: 
// Project file declarations...
program MyCompany.Programs.MyProgram;
namespaces MyCompany.Libs.UIWidgets, MyCompany.Libs.Network;
// Unit source file declaration...
unit MyCompany.Programs.Units.MyUnit1;
Given this program example, the compiler would search namespaces in the following order:
 
MyCompany.Programs.Units 
MyCompany.Programs 
MyCompany.Libs.Network 
MyCompany.Libs.UIWidgets 
Namespaces specified by compiler options. 
Note that if the current unit is generic (i.e. it does not have an explicit namespace declaration in its unit statement), then resolution begins with the project default namespace. 
Using Namespaces
----------------------
uses MyCompany.Libs.Unit2;begin
   writeln(MyCompany.Libs.Unit2.SomeString);
   writeln(SomeString);
end.
A fully qualified identifier must include the full namespace specification. In the preceding example, it would be an error to refer to SomeString using only a portion of the namespace: 
writeln(Unit2.SomeString);       // ERROR!
writeln(Libs.Unit2.SomeString);  // ERROR!
writeln(MyCompany.Libs.Unit2.SomeString);      // Correct.
writeln(SomeString);                           // Correct
----------------------
It is also an error to refer to only a portion of a namespace in the uses clause. There is no mechanism to import all units and symbols in a namespace. The following code does not import all units and symbols in the MyCompany namespace: 
uses MyCompany;   // ERROR!
----------------------
In other words, if a source file uses only the namespace, then fully qualified identifier expressions referring to a symbol in a unit in that namespace must use the namespace name, not the actual unit that defines that symbol.