CONTENTS
The FileInfo.Open() Method .................................................................................................................. 764
The FileInfo.OpenRead() and FileInfo.OpenWrite() Methods ................................................................. 765
The FileInfo.OpenText() Method............................................................................................................ 766
The FileInfo.CreateText() and FileInfo.AppendText() Methods .............................................................. 766
Working with the File Type ............................................................................................766
Additional File-Centric Members .......................................................................................................... 767
The Abstract Stream Class ............................................................................................768
Working with FileStreams .................................................................................................................... 770
Working with StreamWriters and StreamReaders.........................................................771
Writing to a Text File............................................................................................................................. 772
Reading from a Text File....................................................................................................................... 773
Directly Creating StreamWriter/StreamReader Types .......................................................................... 774
Working with StringWriters and StringReaders.............................................................774
Working with BinaryWriters and BinaryReaders............................................................776
Watching Files Programmatically ..................................................................................778
Understanding Object Serialization ...............................................................................780
The Role of Object Graphs .................................................................................................................... 781
Configuring Objects for Serialization .............................................................................783
Defining Serializable Types .................................................................................................................. 783
Public Fields, Private Fields, and Public Properties.............................................................................. 784
Choosing a Serialization Formatter................................................................................784
The IFormatter and IRemotingFormatter Interfaces ............................................................................. 785
Type Fidelity Among the Formatters..................................................................................................... 786
Serializing Objects Using the BinaryFormatter ..............................................................787
Deserializing Objects Using the BinaryFormatter ................................................................................. 788
Serializing Objects Using the SoapFormatter ................................................................789
Serializing Objects Using the XmlSerializer...................................................................790
xxxi