Last active
November 17, 2017 07:01
-
-
Save wheeliechamp/03c3e9f76dde685ba84293d6c8c1916d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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