Read a Whole Textfile Into a String

Sharing is Caring

At work, I’ve been working on an auto html emailer.   I’ve been receiving files from our Latin American office that are completely in spanish and trying to sift through the HTML and recreate the email taking into account size and the fact that Outlook 2007 still doesn’t accept background images and most CSS.

Anyway, one of the files they sent originally that the old software produced didn’t work. And to prove this, I had to somehow figure out how to loop through this text file they’ve been sending and prove this to my boss. I eventually found a function, that would let me avoid the looping, the steam writer and just do it.

System.IO.File.ReadAllText(String fileName)

Author: Brian Cline

Brian is a programmer living in Niagara Falls with ten years of development experience. He is passionate about automation, business process re-engineering, and gamification. For the last six years or so, he has been working with Salesforce and JavaScript.

Related Posts

Sharing is Caring