I am using VSCode to fiddle with C# and I have created a function that is supposed to print out a message (which it does) and then take an input and end the function (which it doesn't). I suspect that the issue is somewhere in Console.ReadLine(), and every guide I find shows Console.ReadLine() being used in exactly the same way, but nevertheless when I push enter while the program is running and after typing a valid String, the Console.ReadLine just repeats and I end up with a new line underneath the old one.
private static String Ask(String message){
String messi = "";
String ans = "";
messi = message;
Console.WriteLine(messi);
Console.WriteLine("Arrived"); //This checks to make sure that we do reach ReadLine()
//ans = Console.ReadLine();
String s = Console.ReadLine();
Console.WriteLine("ArrivedBefore");
return ans;
}
I solved this by writing my own ReadLine method