How to make a Console program, while it processes some task it perform a write in the console (type a counter) asynchronous? independent.
In other words, it will be writing independently of the other processes. Something like:
ex:
private static async Task EscreveConsole()
{
for (int i = 0; i < 100; i++)
{
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("/"); System.Threading.Thread.Sleep(100);
Console.Clear();
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("-"); System.Threading.Thread.Sleep(100);
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("\"); System.Threading.Thread.Sleep(100);
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("|"); System.Threading.Thread.Sleep(100);
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("-"); System.Threading.Thread.Sleep(100);
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("|"); System.Threading.Thread.Sleep(100);
Console.CursorTop = 4;
Console.CursorLeft = 90;
Console.Write("/");
System.Threading.Thread.Sleep(100);
}
}
private static void Main(string[] args)
{
EscreveConsole().ConfigureAwait(false);// queria q isso executasse independentemente
TarefaBaseAsync().Wait();
}