Files and Directories
Exercise: Writing to a file with using
Goal
Write to the local file Actors.txt
- Create a file stream called file with a using statement.
- Create a stream writer called writer using the file stram. This block must not use block syntax { ... } and instead by nested as the single statement under the previous using.
- Write each item in the list actors to the file on a new line. Use a foreach loop for this.
Page 15 of 20