// Example #1
// Read the file as one string.
string text = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");
// Display the file contents to the console.
System.Console.WriteLine("Contents of writeText.txt = {0}", text);
// Example #2
// Read the file lines into a string array.
string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Public\TestFolder\WriteLines2.txt");
Saturday, October 31, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment