Skip to content

Instantly share code, notes, and snippets.

@wheeliechamp
Last active November 17, 2017 07:01
Show Gist options
  • Save wheeliechamp/03c3e9f76dde685ba84293d6c8c1916d to your computer and use it in GitHub Desktop.
Save wheeliechamp/03c3e9f76dde685ba84293d6c8c1916d to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
DateTime start = DateTime.Now;
var test1 = Test1(12345);
IEnumerable<int> counter1 = Enumerable.Range(0, 10);
foreach(int i in counter1)
{
Console.WriteLine(i);
System.Threading.Thread.Sleep(20);
}
Console.WriteLine(test1.Result);
Console.WriteLine(DateTime.Now - start);
}
static async Task<string> Test1(int x)
{
await Task.Delay(10);
await Task.Run(() =>
{
var counter2 = Enumerable.Range(0, 10);
foreach(int i in counter2)
{
Console.WriteLine("---");
System.Threading.Thread.Sleep(20);
}
});
return x.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment