SoftwareEngineering2/ConsoleAppTasks/ConsoleAppTasks/Program.cs
2019-05-03 15:44:56 +02:00

61 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleAppTasks
{
class Program
{
static void Main(string[] args)
{
//var t = new Task(DoIt);
int i = 4;
int y = 0;
//anonyme methode
var t = new Task(() =>
{
Thread.Sleep(2000);
Console.WriteLine("2");
y = 2 * i;
});
t.Start();
i = 99;
t.Wait();
Console.WriteLine(y); //198
/*
for (int i = 0; i < 999; i++)
{
Console.WriteLine("-");
Thread.Sleep(200);
}
*/
Console.ReadLine(); //wait for close
}
private static void DoIt()
{
Console.WriteLine(".");
for (int i = 0; i < 999; i++)
{
Console.WriteLine("+");
Thread.Sleep(500);
}
}
}
}