Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete Task correctly

Tags:

c#

.net

Have I in some way delete this Task or it is self-destroyed?

Task.Factory.StartNew(() => { DoSomeJob(); }, TaskCreationOptions.LongRunning);

or it is better to use it like

var t = Task.Factory.StartNew(() => { DoSomeJob(); }, TaskCreationOptions.LongRunning);

and somehow later delete/nullize t?

Thank you!

like image 547
Friend Avatar asked Oct 12 '12 13:10

Friend


1 Answers

you do not need to delete it, it will be disposed eventually....

like image 138
Z.D. Avatar answered Oct 03 '22 17:10

Z.D.