C#:Read a Text File

From Progzoo
Jump to: navigation, search
You can open a text file and read each line.
  • The StreamReader represents a text file that can process one

line at a time.

  • We use the ReadLine method to obtain a single line of text.
  • When the file has been exhausted the string returned will be null.

The text file http://progzoo.net/haggis.txt includes some lines of text.

[Font] [Default] [Show] [Resize] [History] [Profile]