In Java, if we want to read an user input from the console, we can do the following.
Scanner scn = new Scanner (System.in);
int x;
x = scn.nextInt(); //Receive integer input
In C#, I am assuming we do this:
int x;
x = Console.Read(); //Receive integer input
But when I enter 7 , the output is 55.
The other 2 options for reading inputs are ReadLine() which is probably used for reading strings, and ReadKey() which is proabably for detecting which key you pressed (Please correct me if I am wrong).
Please don't tell me that we have to use ReadLine and parse the entire value to int everytime, that will be awful :-(
EDIT: In SO, a similar question was raised (c# Console.Read() and Console.ReadLine() problems), but all the solutions given was to use int.TryParse and series of codes just to receive a int or double input, which I find it too inconvenient just to do a simple task.
I found out that we could actually do this:
int a = int.Parse(Console.ReadLine());
So instead of asking a duplicated question,
my new question is: Is it equivalent to Java's scn.nextInt() when I use int a = int.Parse(Console.ReadLine()); to receive int inputs?