I have this super exciting program it's a console application, and I want to add a progress bar, but I don't understand how to add an event that kicks off progress increment, and how to display it in the console itself
I hope to use this project for the progress bar itself: https://www.codeproject.com/Tips/5255878/A-Console-Progress-Bar-in-Csharp
class Program
{
static void Main(string[] args)
{
Executer ex = new Executer();
ex.Execute();
//print progress bar here?
}
}
public class Executer
{
public static int progress = 0
public void Execute()
{
Parallel.For(1, 100, i, => {
DoSomething();
//progress++ event?
});
}
private void IncrementProgress()
{
Interlocked.Increment(ref progress);
}
}