Delegate 2.0

Dit is delegate 1.0 manier:

        delegate void doit(string message);
        private void showmessagebox(string message)
        {
            MessageBox.Show(message);
        }

        private void Form1_Load(object sender, EventArgs e)
        {  
            doit hum = new doit(showmessagebox);
            hum.Invoke();
        }

Dit is delegate 2.0 manier:

        delegate void doit(string message);
        private void Form1_Load(object sender, EventArgs e)
        {  
            doit hum = delegate (string message){ MessageBox.Show(message );};
            hum.Invoke("dit is delegate met anonymous delegate ");
        }

En dan delegate 3.0 ( ofwel Lambda )

delegate void doit(string message);
private void Form1_Load(object sender, EventArgs e)
{
 doit hum = new doit (berichtje => MessageBox.Show(berichtje ));
 hum.Invoke("dit is delegate of lambda versie framework 3.0");
}



 

{{opmerking.Naam}}:

{{opmerking.OpmerkingText}}

            

Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!