This method can be used to write to the console in a multithreaded environment, it prints on the current line, clearing any text was previously written.
It also normalizes the text, removing duplicates spaces and newlines, trims the text so it does not overflow to the next line.
// write on the current line, clearing the old text
ConsoleEx.ReWrite("some text");
// clear the current line
ConsoleEx.ReWrite(null);
Writing on the console can be problematic and can be quite slow.
It is suggested that you do not print too often, especially in performance critical code.