Main Thread terminates before Task thread completion
18:56 22 Jul 2015

Hi i need your help guys,

i declared new Task inside my main method like this:

   static void Main(string[] args)
   {    
       Task firstTask = Task.Factory.StartNew(()getPackage(packageId));
       Task secondTask=firstTask.ContinueWith((_=>UpdatePackage(myPackage)));       
   }

My problem is, the main thread terminates before my task completes its action. How should I wait Task to complete its action before terminating the main thread?

c# console taskfactory