I would like the user to enter two different values ββusing only ONE Console.ReadLine() statement. More specifically, instead of using two different variable declarations with two different ReadLine() methods - I want the user to enter two variables at the same time, using the same ReadLine() method for further processing.
Console.ReadLine()
ReadLine()
Something like that?
var line = Console.ReadLine(); var arguments = line.Split(" "); var arg1 = arguments[0]; var arg2 = arguments[1];
In this example, space limits arguments. You can use , or ; as a separator if you want.
,
;
Console.WriteLine("Enter values separated by space"); string input = Console.ReadLine(); string[] inputs = input.Split(' '); foreach (string inp in inputs) { Console.WriteLine(inp); }