Delegate, delegation
Public delegate void EventHandler (object sender, EventArgs e); pulic EventHandler HandleMapMessage; HandleMapMessage = MapControl; public void MapControl (obeject sender, EventArgs e ){....}
The Delegate in C # is said to be equivalent to the C ++ function pointer. In the preceding example, we first define a delegate using the syntax delegate (which is exactly the same as the function signature, but only has a keyword delegate), which is equivalent to a custom type. Then, you can declare an instance of a custom delegate (meaning a class instantiation object), such as the public EventHandler HandelMapMessage in the Code. Finally, you can define a function to implement specific functions and return the type, the number of parameters. The order and type of the parameters must completely match the custom delegate. It is estimated that the parameter can be uniquely identified. Then assign the value: HandleMapMessage = MapControl (it is estimated that they will point to the same memory address)