Basic knowledge of C # II
1. Static field, static member: shared by all instances of the class, changed, visible to all instances.
2. Declarations are static: Fields, methods, properties, constructors, operators, events.
3, constant and static quantity are different: constants do not have their own storage location, at compile time by the compiler replaced.
4. Class attributes are different from class fields: A property is a function member that does not allocate memory for the data store and executes code.
5. All paths to the property Get accessor must contain a return statement that returns the value of a property type.
6. The instance constructor is a special method that executes at instance creation time to initialize the state of the instance and declare it public, unless you want to declare the singleton schema as private.
7. The constructor has the same name as the class name and cannot have a return value.
8, the constructor default is no parameter, the method body is empty. Custom can take parameters, can be overloaded
9. When customizing a constructor, the default 0 parameter constructor is not available, and you want to customize the 0 parameter constructor.
10. Static constructors: There can be only one in a class and cannot have parameters, and access modifiers cannot be used.
11. Static constructors cannot be called from a program and are automatically called by the system, before the class instance is created, before the static members of the class are referenced.
12. Object Initialization list: Members must be public in the creation object, and initialization occurs after the constructor completes.
13. The destructor performs the cleanup or release of unmanaged resources before the instance is destroyed, with only one, no parameters, no access modifiers, the same name as the class but prefixed with "~", only works on the instance, there is no static destructor, and the destructor cannot be called explicitly in code.
14. Destructors should only dispose of the object's own external resources and should not access other objects.
15. The difference between the Const field and the ReadOnly field is that the former value is determined at compile time, and the latter can be determined at run time.
16, this keyword uses the scope: instance constructor, instance method, property, and index instance accessor.
17. Declaration index: The name of the index is this, and the argument list is in the middle of the square brackets with at least one parameter.
18. An overloaded index in a class must have a different parameter list.
19. Accessor's access modifier important restriction: only if a member has both get and set, it can have an access modifier, but only one has an access modifier.
20. Partial class: Same as the normal class declaration, except for that additional type modifier, partial.
21, Partial method: Defines the declaration to give the signature and return type, the implementation part is only a semicolon; The implementation declares the signature, the return type, and the normal form of the statement block implementation.
22. Partial method declaration signatures cannot contain modifiers, the return type must be void, and the argument list cannot contain out parameters.
23, the partial method can have the definition part can have no realization part. There must be a definition section for the implementation part.
24. Class Inheritance: Extends existing classes, existing classes are base classes (base class), and new classes are called derived classes (derived class).
25, the object class is the base class, is the only non-derived class, and all other classes are derived classes.
26, a class can only single inheritance, the hierarchy of inheritance is not limited.
27. The data member in the derived class to hide the base class: Declares a new member of the same type and uses the same name.
28. A function member in a derived class to hide a base class: Declares a new function member with the same signature. The signature consists of a name and a list of parameters, not including the return type.
29. In a derived class, to hide a member, add new to the previous member, and let the compiler know that you intentionally hide the member.
Basic knowledge of C # II