This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ct as a file or send objects over a network Taking such a "snapshot" is difficult because
Objects often contain other objects
Object variables and fields are references
References are addresses; meaningless when saved The entire process is called serialization
Only works on classes marked [Serializable] Serializing an Array
Let's use serialization to write an entire array to disk
Add namespaces System.Runtime.Serialization
Create a BinaryFormatter using default constructor
Open a FileStream (or any stream) for output
Call the formatter's Serialize() method to write data To deserialize, call the Deserialize() method
You have to cast the returned value to the correct type Can also use the SoapFormatter for XML storage 28 I/O and Networking
System.Net System.Net contains all network protocol
Low-level support for IP sockets
Application level protocol implementations
Authentication methods for HTTP
Basic, Digest, NTLM Challen...
View Full Document
This note was uploaded on 04/04/2014 for the course CS 5950 taught by Professor Staff during the Summer '08 term at Western Michigan.
- Summer '08