You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have this code (from examples just with an async delay):
public class Program
{
public static async Task Main(string[] args)
{
const int totalTicks = 10;
var options = new ProgressBarOptions
{
ProgressCharacter = '─',
ProgressBarOnBottom = true
};
using (var pbar = new ProgressBar(totalTicks, "Initial message", options))
{
for (var i = 0; i < totalTicks; i++)
{
pbar.Tick(); //will advance pbar to 1 out of 10.
await Task.Delay(1000);
}
}
}
}
Then my output looks like this:
If I run it non-async with Thread.Sleep(x) as follows:
public class Program
{
public static void Main(string[] args)
{
const int totalTicks = 10;
var options = new ProgressBarOptions
{
ProgressCharacter = '─',
ProgressBarOnBottom = true
};
var pbar = new ProgressBar(totalTicks, "Initial message", options);
for (var i = 0; i < totalTicks; i++)
{
pbar.Tick(); //will advance pbar to 1 out of 10.
Thread.Sleep(1000);
}
}
}
My output looks like this:
What am I doing wrong? My understanding is it should appear on one line and continuously update that line.
Many thanks!
The text was updated successfully, but these errors were encountered:
Edit: I'm using .NET 5.
If I have this code (from examples just with an async delay):
Then my output looks like this:
If I run it non-async with
Thread.Sleep(x)
as follows:My output looks like this:
What am I doing wrong? My understanding is it should appear on one line and continuously update that line.
Many thanks!
The text was updated successfully, but these errors were encountered: