C # Summary of basic knowledge points,
No information will be lost during conversion
The explicit conversion condition of the type is relative to the above
<1> You must assign a value to the local variable when reading and obtaining the money.
<2> function parameters must be provided when a method is called.
<3> all other variables (such as fields and array elements) are automatically initialized at runtime (use the default values of their types)
Default Value of all reference types: null
Default values of all values and enumeration types: 0
Default character type: '\ 0'
Boolean default value: False
You can use the default keyword to obtain its key value.
The indexer is compiled into the get_Item () and set_Item () methods in the system.
28.4 initialization sequence of constructor and Field
(1) From subclass to base class: initialization field à specifies the variable in the constructor of the base class to be called
(2) From base class to subclass: Constructor
- Public: full access permission, which is the implicit access permission of Enumeration type members or interfaces.
- Internal
- Private: only visible within the type. default access permissions for class and struct members
- Protected: Visible only in the class and subclass
Public class Test: ITest {
ITest. DoSomething () {}// explicit IMPLEMENTATION OF THE INTERFACE
}
Note: The only way to call an explicitly implemented member is to convert the object to the corresponding interface.
Test t = new Test ();
(ITest) t. DoSomething ();
- Virtual method implementation interface member
By default, the implementation of interface members is implicitly defined as sealed. To be reloaded, the base class must be identified as Virtual or abstract
Public class Test: ITest {
Public virtual void DoSomething (){}
}
Note: explicitly implemented interface members cannot be identified as virtual