Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMegan Gorbet
9,427 PointsTrying to convert int to string?
I'm trying to end the loop by reducing the int of the entry variable by 1 by calling parse. But, I keep getting a compiler error saying that I can't convert an int to a string.
Megan Gorbet
9,427 PointsNever mind, I actually figured out the problem. Thanks, though.
2 Answers
Andy Swinford
8,152 PointsThe simplest way to accomplish this would be:
string myString = myNumber.ToString();
Jacob Bergdahl
29,119 PointsYou don't use Parse to convert an integer to a string, since an integer can always be turned into a string. You can convert an integer to a string like so:
string test = Convert.ToString(1);
bothxp
16,510 Pointsbothxp
16,510 PointsCan you post your code so that we can take a look at what's going on?