Task.Run()

This commit is contained in:
Hendrik Schutter 2019-05-04 11:41:48 +02:00
parent af44f95dd3
commit 3d7584b5dc
1 changed files with 15 additions and 4 deletions

View File

@ -15,9 +15,20 @@ namespace ConsoleAppLock
static void Main(string[] args)
{
foreach (var VARIABLE in getList())
Task t = Task.Run(() =>
{
int i = 5;
int b = 2 * i;
Console.WriteLine("Result: " + b);
}
);
// t.Start(); //geht net nochmals
foreach (var item in getList())
{
Console.WriteLine(VARIABLE);
Console.WriteLine(item);
}
@ -111,13 +122,13 @@ namespace ConsoleAppLock
static IEnumerable<string> getList()
{
// List<int> intlist = new List<int>();
Console.WriteLine("started");
// List<int> intlist = new List<int>();
for (int i = 0; i < 10; i++)
{
Console.WriteLine("generate List");
//intlist.Add(i);
yield return i.ToString();
}