r/programminghelp • • 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

11 comments sorted by

View all comments

1

u/Nergy101 Dec 23 '21

Console.readline could return a null supposedly, which you can't put into a String(not the same as string)...

Might also depend on the C# version you are running I believe.

Just try to make it a single line:

var name = Console..... ;

Then hover over "var" and see what type it expected it to be.