I have a question with the following example, I do not understand what exactly CursorTop
and CursorLeft
do not do SetCursorPosition
.
using System;
class Sample
{
protected static int origRow;
protected static int origCol;
protected static void WriteAt(string s, int x, int y)
{
try{
Console.SetCursorPosition(origCol+x, origRow+y);
Console.Write(s);
}catch (ArgumentOutOfRangeException e){
Console.Clear();
Console.WriteLine(e.Message);
}
}
public static void Main()
{
Console.Clear();
origRow = Console.CursorTop;
origCol = Console.CursorLeft;
WriteAt("+", 0, 1);
}
}