C # basic knowledge 3,
C # basic knowledge 3
1. Inter-assembly inheritance: The base class must be declared as public and include Assembly references to the base class in the project.
2. Differences between referencing other sets and adding using commands: the former tells the compiler where the types required are defined, and the latter does not need to use their fully qualified names. Example: Call Mydll
3. The member access modifier protectedinternal is accessible to all classes that inherit the class or are declared within the Assembly. That is, the Union of protected and internal, rather than the intersection.
4. abstract members: abstract members are marked with abstract tags, without implementing code blocks. They are replaced by semicolons.
5. abstract classes can only be used as the base classes of other classes, and cannot be used to create instances of abstract classes.
6. sealed class: it can only be used as an independent class. It cannot be used as a base class or as a sealed modifier.
7. static class: it is marked with static. All the members of the class must be static. There can be a static constructor which cannot be inherited. They are sealed.
8. Extension Method: the extension method must be declared as static and Its Class must also be static. The extension method must contain the keyword "this" as its first parameter type, and follow the name of the extended class. Example:
Static class ExtendMyData // it must be a static class {public static double Average (this Mydata md) // It must be public and static. The keyword this, extension class name Mydata {//....... }}
9. External method: Use the extern modifier to replace the semicolon for implementation. The declarative and implemented connections are often completed using the DLLImport feature. For example, obtain the string of the current directory, which is called by the win32 system. Example
10. Integer suffix meaning: 23-integer; 23L-long integer; 23U-unsigned integer; 23UL-Unsigned long integer
11. Meaning of real Suffix: 236F-float; 236.714-double type without suffix.
12. character meaning: it consists of characters in single quotes.
13. String meaning: Double quotation marks. It can be divided into rule strings and word-for-word strings. All characters including escape characters in double quotation marks are printed strictly in sequence. The only exception is that adjacent double quotation marks are interpreted as single double quotation marks, the latter method adds the @ prefix to the string.
14. Binary operators are left-bound. The value assignment operator and the condition operator are right-aligned. (From left to right .)
15. Comparison between depth and depth. The commonly used = is the shallow comparison.
16. Increment and decrease operations: after the statement is executed, the value of the stored operands is the same, and the only difference is the value returned to the expression. Values are calculated after the first assignment, and then the second assignment.
17. Conditional logical operators: And & (both true and true are true); or | (one true is true); not! (The opposite result ).
18. Use the "Short Circuit" mode in the conditional operation and (&) operation. As long as the first operand is false, the second operand will not be calculated. Therefore, do not carry any action in the second operation.