Files and Directories
Exercise: Writing to a file
Goal
Write to the local file Actors.txt
- Create a file stream called file using the local file "Movies.txt" to overwrite the file
- Create a stream writer called writer using the file stream
- Write each item in the list actors to the file on a new line. Use a foreach loop for this
- After the loop, close the reader.
Page 12 of 20