Object-Oriented delegation

Source: Internet
Author: User

Delegate: Delegate: Can be understood as a container for a function,

Which function the delegate points to represents the function

The delegate's keyword is delegate

The delegate is the same class classes, it needs to be written outside the classs. The main function differs from the normal function as the total entrance.

Delegate quite a shortcut

A container of functions that can hold functions of the same parameter type. Definition: public delegate void Mydele (int a,int b);

Usage: ① creates a variable inside the main function, Mydele Md;② a function that meets its requirements into the variable, Class1 c=new Class 1 (); Md=class1.add;③ use, MD ();

The addition operation between the delegate variables (must be of the same type); md=a+b; The subtraction operation between the delegate variables (must be of the same type); md=md-b;

Form: Also a class inherits from the form class (with various small controls) partial divides the class into two parts: the interface part, the code part.

Control actions: Drag, Ctrl + Drag right-click, properties, Text

A control is actually a class, and the process of dragging is the process of creating an object.

Menuscript:

Debug folder:

Object-Oriented delegation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.