Okay, I'm trying to learn C# (coming from c++).
I found this code on a tutorial.
When I try to compile it I get this error
"cannot implicitly convert from 'int' to 'string'"
I thought it was supposed to convert it from string to int???

int Number;

        Number = int.Parse(Console.ReadLine());

Code is correct.

int Number;
Number = int.Parse(Console.ReadLine());

Following code will throws an error : cannot implicitly convert from 'int' to 'string

string Number;
Number = int.Parse(Console.ReadLine());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.