Files and Directories

Exercise: Reading from a file

Goal

Read from the local file Movies.txt

  1. Create a file stream called file using the local file "Movies.txt"
  2. Create a stream reader called reader using the file stream
  3. While we are not at the end of the stream, create a local string declaration named movie and assign this the value of the next line from the file
  4. Write each movie to the Console using WriteLine.
  5. After the loop close the reader
Page 11 of 20