Check out example codes for "How to determine whether Task.Run is completed within a loop in c#". It will help you in understanding the concepts better.

Code Example 1

System.Threading.Tasks.Task
.Run(() => 
{
    // simulate processing
    for (var i = 0; i < 10; i++)
    {
        Console.WriteLine("do something {0}", i + 1);
    }
})
.ContinueWith(t => Console.WriteLine("done."));

Learn ReactJs, React Native from akashmittal.com