Method Group Coversion Syntax

Sahil Malik has come up with a good post on using ParameterizedThreadStart. One of the things that I wanted to point out whilst reading his post was that other nice thing about delegates that was introduced in C# 2.0 where you can convert method names to delegates automatically where a delgate is expected. The following picture is a simple piece of threading code that declares the parameterized thread start explicitly.

 

The following code instansiates the thread specifying the target without explicitly instansiating the delegate. This is referred to as method group conversion syntax. A nice little language feature.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s