I just started my project and I want to know if it's posibble to do async without tasks and await like I tried to do. This is what I want it to do: I want to wait 2 second and then do something, but if I press 1 on numpad it will skip waiting. This is everything that I have to now:
static async void DelayedWork(int body, int noveBody)
{
ConsoleKey consoleKey = Console.ReadKey().Key;
if (consoleKey == ConsoleKey.NumPad1)
{
DoSomething();
}
else
{
}
}
static void Game()
{
DelayedWork();
System.Threading.Thread.Sleep(2000);
DoSomething();
}
Is await or task necessary to do this? Because in this phase it doesn't work...