Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Beginner Threading
Ok, this might be blindingly obvious to most Sigh | :sigh:
 
Say I have a thread
Thread myThread;
What is the difference between,
Thread myThread = new Thread(Work.DoWork);
and
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 13:57pm
la011.1K

1 solution

Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 21 Apr 2010
Copyright © CodeProject, 1999-2014
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