C # Key knowledge detailed (five generations: 1)

zhaozj2021-02-08  225

Guide: The agent is implemented by a pointer function such as a language such as C , a different function pointer, an agent is an object-oriented, secure type.

Author: wkrain www.ASPCool.com Chapter: Acting Deputy achieve is like pointers c and other languages ​​function, unlike the function pointer, the proxy is an object-oriented, type-safe. Acting a reference type of a public base class (system), the method is pressed into an agent, and the instance method is called the instance of the instance of the instance, or the method of the instance, and the static method is called the composition of the class. Entity or class method. The powerful function of the agent is that it can automatically match the method, regardless of its type. Write a proxy includes three steps: write agency, instantiate, call. Agent's statement: delegate void SimpleDelegate (); instantiate a proxy class test {static void f () {system.console.writeline ("Hello World");} static void main () {SimpleDelegate D = New SimpleDelegate (F); // press the method into D (); // passed the agent; f (); // does not pass the agent;}} Let us call her void multicall (SimpleDelegate D, int count) {for (INT i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-2329.html

New Post(0)