June 2006
Intermediate to advanced
1344 pages
42h 52m
English
The preceding section showed how to create a sequential-access file using object serialization. In this section, we discuss how to read serialized objects sequentially from a file.
Figure 18.15 reads and displays the contents of the file created by the program in Fig. 18.14. Line 10 creates the BinaryFormatter that will be used to read objects. The program opens the file for input by creating a FileStream object (line 35). The name of the file to open is specified as the first argument to the FileStream constructor.
1 ' Fig. 18.15: FrmReadSequentialAccessFile.vb 2 ' Reading a sequential-access file using deserialization. ... |
Read now
Unlock full access