1. Object-oriented
1. User Interface: a specification.
1) method definitions of interfaces cannot be implemented.
2) If the interface is inherited, the interface definition must be fully implemented.
Interface Definition
Interface Name
{
// Code // access public by default
}
Multi-inheritance Interface
Public Class Name: parent, interface, interface2 // separated by commas
2. keyword is: used to check whether an object is compatible with the given object type.
If (obj is person)
{
}
3. keyword as: used for object conversion. If the operation fails, null is returned. // as does not cause an exception.
4. Keyword New: Used to overwrite the new members of the parent class and has no relationship with the parent class. It is generally used to avoid polymorphism.
2. Delegate and event)
1. Delegate
Generally, three steps are required for delegation.
1. Define Delegation
Access modifier delegate return type funname (parameter list) // funname function name
2. instantiate the delegate
Funname name = new funname (function parameter) // The function is a function that returns the same list of parameters as the delegate.
3. Call the delegate
Name (parameter list );
Similar to C ++ function pointers. The delegate can be considered as a type with parameters.
The delegate itself is a static type. The delegate is called by class name.
2. Events.
Events are implemented by delegation.
Generally, events are divided into four steps:
1. Define the event proxy (define delegation)
2. Define an event, for example, a public event Delegate name event name
3. Name of the trigger event ();
4. Associated events such as: event name + = new delegate name (function 1); // function 1 is called every time an event is triggered.
Using Structure
Using ()
{
} // When the object is out of scope, the using structure will automatically call dispose (); Delete the object
Filestream // stream to access files.