r/programminghelp • u/Logical_Ideal • Dec 23 '21
C# Why this code gives CS8600 problem
C# Example:
String name;
name = Console.ReadLine();
Console.WriteLine(name);
This problem only occurs in ReadLine....why?
6
Upvotes
r/programminghelp • u/Logical_Ideal • Dec 23 '21
C# Example:
String name;
name = Console.ReadLine();
Console.WriteLine(name);
This problem only occurs in ReadLine....why?
1
u/fehh123 Jan 24 '22
not a good practice but:
Just put a "!" at the end of the Console.ReadLine();
so your code will look like:
String name;
name = Console.ReadLine()!;
Console.WriteLine(name);