Click here to Skip to main content
13,090,299 members (76,604 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Ok, this might be blindingly obvious to most :sigh:

Say I have a thread
Thread myThread;
What is the difference between,
Thread myThread = new Thread(Work.DoWork);
Thread myThread = new Thread(new ParameterizedThreadStart(Work.DoWork)); 

MSDN says, C# infers the appropriate delegate creation syntax: new ParameterizedThreadStart(Work.DoWork). So does that mean the above 2 lines are identical?
Posted 21-Apr-10 12:57pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

So does that mean the above 2 lines are identical?

Yes, that's exactly what it means. The verbose version was the only way to do it in C# 1.0, and under the hood it's still what's happening - but since the delegate instantiation is fairly obvious from the context, C# 2 and later don't require you to actually specify it unless there's some sort of ambiguity.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 21 Apr 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100