Can someone explain me those C# tasks? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain me those C# tasks?

See questions

4th Feb 2017, 2:08 PM
Florian Meyer
Florian Meyer - avatar
3 Answers
+ 2
A task is something you want done by a thread. A great example I read from StackOverflow is "Basically, a Task<T> "promises" to return you a T, but not right now, I'm kinda busy, why don't you come back later?" To put it another way, a task is something that you want done, but a thread(the worker to do it), shouldn't be made for each and every task. A task is really a small job for a thread to do, when it can get around to it. This way, you're having one thread(a worker) count 20 things, instead of 20 threads counting 20 things. Here are some resources that are very helpful to explain this more in depth. I recommend StackOverflow's explanation, as it goes pretty deep into it without being a dry read. https://msdn.microsoft.com/en-us/library/system.threading.tasks.task(v=vs.110).aspx http://stackoverflow.com/questions/4130194/what-is-the-difference-between-task-and-thread
6th Mar 2017, 12:21 AM
Raguth Wolf
Raguth Wolf - avatar
+ 1
thank you sooo much😄😄
6th Mar 2017, 5:32 AM
Florian Meyer
Florian Meyer - avatar
+ 1
Glad to be able to help!
6th Mar 2017, 5:34 AM
Raguth Wolf
Raguth Wolf - avatar