Thursday, March 27, 2008

Delegates

This has always been a topic that I have never quite grasped.
I learnt yet another cool trick with delegates that other day though!

You can start a new thread as below:

Thread thread = new Thread(this.Test);

private void Test()
{
// do stuff
}


But you can also do it like this:

Thread thread = new Thread(delegate()
{
// do stuff
}
);


Cool... :-).