using System.Diagnostics;
using System.Threading.Tasks;
public static void Main()
Stopwatch st = new Stopwatch();
Program p = new Program();
var counter = Task.Run(() => p.TestAsync()).Result;
Console.WriteLine("Counter : " + counter);
Console.WriteLine("Total Sec : " + st.ElapsedMilliseconds.ToString());
public async Task<int> TestAsync()
for (int k = 15; k <= 20; k++)
var result =await Task.Run(()=> GetLongRunningTask("Hello " + k));
Console.WriteLine(result);
public string GetLongRunningTask(string input)
Console.WriteLine(input + "__"+i);
for (int z = 0; z < 10; z++)