Reputation: 13
Console.WriteLine("Enter arguments");
string input = Console.ReadLine();// red line under Console.ReadLine
Console.WriteLine("Arguments at run-time " + input);
/* I want to show the user input in string through my Console.WriteLine method and I know by-default it is in string type so why am getting red line under Console.ReadLine when using string and not when store in var type? Thanks! */
Upvotes: 0
Views: 1237
Reputation: 26
The Console.ReadLine();
function can return a null value and the IDE indicates that for safety. Use string?
.
Upvotes: 1