You have seen how the various collections store items, how to access their elements, and even how to sort and search the collections. To make the most of the collections and to use them to store large sets of data, you should also learn how to … [Read more...] about What is Serialization? & Serialization Types
Serialization and XML
Using Binary and SOAP Serialization
Let's start with binary serialization, which is implemented in the following namespace (you must import it into your application): This namespace isn't loaded by default, and you must add a reference to the corresponding namespace. Right-click … [Read more...] about Using Binary and SOAP Serialization
Persisting a HashTable
In this section, you'll look at the code for persisting a HashTable to disk. The code I present in this section belongs to the WordFrequencies project, which was presented in Chapter, ‘‘Storing Data in Collections''. The WordFrequencies application … [Read more...] about Persisting a HashTable
Persisting a TreeView’s Nodes
In section "The TreeView and ListView Controls", you learned how to populate the TreeView and ListView controls, how to manipulate them at runtime, and how to sort the ListView control in any way you want. But what good are all these techniques … [Read more...] about Persisting a TreeView’s Nodes
Using XML Serialization
In addition to the Serialization namespace, which contains the SOAP and BinaryFormatter classes for serializing data into SOAP and binary format, the .NET Framework provides another name space for serializing data: the XmlSerialization namespace. As … [Read more...] about Using XML Serialization
Serializing and Deserializing Individual Objects
Serializing a single object in XML format is as simple as the other types of serialization. However, you can't serialize multiple objects into the same file because of the specifications of an XML document. An XML document has a single root element, … [Read more...] about Serializing and Deserializing Individual Objects
Serializing Custom Objects
Listing 12.13 shows a class that describes books. The Book class is quite trivial, except that each book can have any number of authors. The authors are stored in an array of Book.Author objects. Listing 12.13: Book Class The following … [Read more...] about Serializing Custom Objects
Serializing ArrayLists and HashTables
Although ArrayLists and HashTables aren't serializable in XML format, there will be occasions when you want to serialize data stored in collections of these two types (and perhaps other types of nonserializable collections). I singled out ArrayLists … [Read more...] about Serializing ArrayLists and HashTables
Working with XML Files – Understanding XML Structure
Two advantages of the XML format are that humans can read it and there are many tools for manipulating it. To pave the way to the following chapter, let's examine the structure of an XML document and look briefly at the tools for editing XML … [Read more...] about Working with XML Files – Understanding XML Structure
Editing XML Files
You can easily edit the XML file. Apart from changing the values of existing elements, such as a book's price or page count, you can insert new elements. Let's add a new author to the second book. Create a new line before the closing tag … [Read more...] about Editing XML Files