How To Read A Text File In C#

added by DotNetKicks
12/2/2021 4:29:52 PM

423 Views

The File class provides two static methods to read a text file in C#. The File.ReadAllText() method opens a text file, reads all the text in the file into a string, and then closes the file. The following code snippet reads a text file in to a string.


0 comments