Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What would be difference between the following approach?
C#
Task.Factory.StartNew(() => CustomConnection());

C#
new Thread(CustomConnection).Start();

Both will create the new thread for performing the job. in what sense thread differs from task?
Performance wise which would the better option?? which option is advisable??
Posted

1 solution

A task is something you want doing.

A thread is one of possibly many workers who perform that task.

In .NET 4.0 terms, a Task represents an asynchronous operation. Thread(s) are used to complete that operation by breaking the work up into chunks and assigning to separate threads.

see this as well,
msdn[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900