How to read an entire file to a string using C#?

How about File.ReadAllText:

string contents = File.ReadAllText(@"C:\temp\test.txt");

Leave a Comment