954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Learning C# trouble with parse function

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());
wade2462
Newbie Poster
16 posts since May 2010
Reputation Points: 10
Solved Threads: 1
 

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());
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: