Click here to Skip to main content
11,643,493 members (81,586 online)
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 12: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 485
1 jyo.net 480
2 DamithSL 328
3 Sergey Alexandrovich Kryukov 270
4 CPallini 222
0 DamithSL 541
1 OriginalGriff 495
2 Mika Wendelius 469
3 Sergey Alexandrovich Kryukov 330
4 Afzaal Ahmad Zeeshan 324


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 21 Apr 2010
Copyright © CodeProject, 1999-2015
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