C# clear Console last Item and replace new? Console Animation

c#, console.writeline

Solution

If your problem is clearing the console then use the method `Console.Clear();`, if it's not, use this to overwrite the last line;

Console.WriteLine("Searching file in...");
        foreach(var dir in DirList)
         {
           Console.SetCursorPosition(1,0);
           Console.WriteLine(dir);
         }

Problem

The following CSharp Code(just sample): ``` Console.WriteLine("Searching file in..."); foreach(var dir in DirList) { Console.WriteLine(dir); } ``` Prints Output As: ``` Searching file in... dir1 dir2 dir3 dir4 . . . ``` Question? How can I get the output as ``` Searching file in... dir1 ``` (then clear dir1 and print dir2 and so on)All next dir name wiil replace the previous dir

Original source

Related problems