1. You can add a using statement to the top of a file to include the namespace,
so that you do not have to fully qualify references to classes in the
namespace.
2. A stream object is used to transfer data to and from a data file. The
StreamWriter outputs (writes) the data and the StreamReader inputs (reads)
data.
3. The constructors for a StreamWriter and StreamReader take the name of
the file, with an optional path, as a parameter.
4. The WriteLine method writes a data line to disk.
5. A Close method should be used as soon as you are done with the stream.
Make sure the stream is closed prior to the termination of a program that
uses streams.
6. The Peek method looks at the next element, which allows testing for the
end of the file. The Peek method returns –1 at the end of file.
7. List box data may be saved to a stream. The Items collection should be
filled in the Form_Load method if the file exists. Any changes are saved
back to the file when the program terminates.
8. A boolean variable is used to track whether changes have been made to the
data.
9. The form’s FormClosing event handler is a good location for the code to
prompt the users whether to save any changes.
10. The OpenFileDialog and SaveFileDialog components can be used to display
the Open File and Save As dialog boxes and allow the user to select the
filename.
11. C# contains classes for accessing XML files in the System.Xml namespace.
Using properties and methods, you can access the elements of an XML file.
To learn more about the book this website supports, please visit its Information Center.