How to read an entire file to a string using C#?
To read entire file in C# as string we can use File.ReadAllText
:Example
string contents = File.ReadAllText(@"C:\temp\test.txt");
File.ReadAllText
:string contents = File.ReadAllText(@"C:\temp\test.txt");
In this page (written and validated by A. Gawali) you learned about How to read an entire file to a string using C#? . What's Next? If you are interested in completing C# tutorial, we encourage you simply to start here: C# Tutorial.
Share On: |