1. The static (type) constructor should not call the static (type) constructor in the base class because the static field is not inherited by the derived class (
That is, objects such as static fields defined in the parent class cannot be accessed in their child classes .), A class can have only one static constructor and must
There is no parameter.
2. When necessaryProgramWhen the domain is closed, someCodeUse the domainupload event of system. appdomain.
Iii. CLR assume that all method parameters are delivered by value. When a parameter is an object of the same type, the parameter can be passed
To reference (or pointer) the object. The parameter corresponding to the value type is passed to the method as a copy of the Value Type instance.
. This means that the method gets a copy of its own value type instance, and the instance in the code that calls this method will not be affected.
.
4. Out: You can skip initialization before calling the API. You must assign a value to the out parameter before returning the API. The called method cannot directly read
Value. Ref must be initialized before calling. You can define the ref overload, but the ref overload is the same as the out overload. All
During loading, if both ref and out are reloaded, the other of them will not work. Because the Il code generated by the compiler is the same.
5. the variables passed by reference must be of the same type as the parameters declared by the method (that is, if the method is an object-type parameter
When using this method, you must change the parameter to convert it to an object before passing it in ).
6. Variable Number Parameter: Param, which is the last parameter of the method, but must be the last parameter.
7. New keywords. Used to hide methods with the same name in the base class.
8. attribute: No parameter attribute (Intelligent field), including the parameter attribute (the parameter attribute in C # Is the indexer ).
Defining an attribute is that the compiler will generate the following three items in the managed heap: 1. A get accesser method that represents the attribute. 2. A Set
Attribute accessors (methods 1 and 2 must be available only when the get or set accessors are defined ). 3. An owner in the metadata of the managed stack Module
The attribute of read-only, write-only, or read/write. Attribute is just a class method.
The upper "GET _ + attribute name" and "SET _ + attribute name" constitute a method, which contains two parameter attributes (Indexer) and cannot be named. Get_item,
Set_item generate the corresponding method (you can set the feature to modify the item so that other index method names change ).
9. indexer: The indexer must have at least one or more parameters and can be reloaded. Using object as the parameter
It is a common method in array query. hashtalbe must be an object-type indexer. The index value of the indexer can be
It can be a number, a character, or a string. The Set Method of the index has an implicit parameter of value, just like the non-parameter attribute. The
The parameter indicates the new value expected by the indexed element. CLR does not distinguish between the parameter-free attribute and the parameter-included attribute. For the CLR attribute rescue class
Type. The index indexer (including the parameter attributes) will also generate three objects (article 8) Just as there is no parameter attribute ).