C # Commissioned Tutorials Dry

Source: Internet
Author: User

Entrust these two days how much understand point, but easy brain dizzy, summed up under

A delegate is a declaration of an object that allows him to help other programs execute. The Richbox is displayed as a cross-thread.

1         //declaring a named delegate with no return value2         Delegate voidMsghandler (stringtxt);3         //Msghandler Msgdele, Msgdels, Msglambda;4 5         Private voidForm1_Load (Objectsender, EventArgs e)6         {7             //putting a method in a thread8Thread TRD =NewThread (NewThreadStart (Start));9 TRD. Start ();Ten         } One  A         voidStart () -         { -             //named method instantiation theMsghandler Msgdele =NewMsghandler (msgshow); -              -             //using named Methods -             //Msgdele ("naming method"); //calling within a thread +Rbox. Invoke (Msgdele,"Naming Methods");//for out-of-thread -  +             //anonymous method delegate type delegate variable = delegate ("parameter list") {code block}; AMsghandler Msgdels =Delegate(stringtxt) at             { - msgshow (TXT); -             }; -              -              -             //calling within a thread in             //msgdels ("anonymous Method"); -              to             //for out-of-thread +Rbox. Invoke (Msgdele,"Anonymous Methods"); -              the              *             //Lambda declaration Method $Msghandler Msglambda = p = ={msgshow (P);};Panax Notoginseng             //Msglambda ("Lambda"); -  the             //for out-of-thread +Rbox. Invoke (MSGLAMBDA,"Lambda"); A         } the  +  -         //Execution Method $         Private voidMsgshow (stringtxt) $         { -             //the same as normal use -Rbox. AppendText (txt +"\ r \ n"); the}

C # Commissioned Tutorials Dry

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.