title: What is a task lifecycle? when will it end or collected in C#?
body: <p>I'm pretty new in TPL, and I'd like to get an answer to the question :
  What is a task lifecycle? when will it end or collected in C#?
  If the task is created for a single use - it does its one-time work and then completed - do I need to cancel it?
  does the garbage collector collect it?</p>
  
  <p>Here is an example:</p>
  
  <pre><code>    DoSomething()
     {
        Task task = Task.Factory.StartNew(()=&gt;DoOneTimeWork());
     }
  </code></pre>
  
  <p>Is there anyone who can tell me what happened to the local task after DoOneTimeWork is ended?</p>
  
  <p>Thanks a lot!</p>