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#

Display .txt file in C#

I am trying to figure out how to display a .txt file. I cannot figure out the right code. To be more specific, I am working on a project with a drawing made out of numbers and symbols and it is in a .txt file. I want to figure out the proper code to just display that in the console or something. Please help!

2 Answers

This documentation will help:

https://msdn.microsoft.com/en-us/library/system.io.file(v=vs.110).aspx
James Churchill
STAFF
James Churchill
Treehouse Teacher

Keifer,

As Martin mentioned above, I'd check out the File class. One of the static methods on the File class is ReadAllText, which will read all of the text from a file.

https://msdn.microsoft.com/en-us/library/ms143368(v=vs.110).aspx

Thanks ~James