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 trial

C#

digit to word conversion

how to convert digits to words in asp.net and in c#

2 Answers

Steven Parker
Steven Parker
231,184 Points

You probably want the .ToString() method.

Depending on the context there will likely be other choices, but invoking the .ToString() method on a numeric literal or variable is a good generic way to convert a number to a string.


On the other hand, if by "words" you mean things like "two hundred thirty six", you're probably doing a homework assignment, and you will need to write a program for that.

Steven Parker
Steven Parker
231,184 Points

Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime. :fishing_pole_and_fish:
    ― Maimonides