I'm trying to display percentages of loading in the same place
and I found solution on that
Console.Write($"\r{ (double) (i+1) * 100 / list.Count }% - {text}");
but after the percentage I'd want to display some text which has different lengths e.g something between 20-40 characters
The problem with this approach is that if "new" line is shorter than "previous" then some part of "previous" text still remains there.
I managed to write 'hack' which overwrites current line with spaces (clears it) and then writes my line
Console.Write($"\r ");
Console.Write($"\r{ (double) (i+1) * 100 / list.Count }% - {text}");
Is there an better solution to do that?