public static void Deserialize(StreamReader reader, BookDictionary dictionary) { dictionary.Clear(); XmlSerializer serializer = new XmlSerializer(typeof(List <Pair>)); List <Pair> list = (List <Pair>)serializer.Deserialize(reader); foreach (Pair entry in list) { dictionary.Add(entry.Value); } }
public static void Serialize(StreamWriter writer, BookDictionary dictionary) { List <Pair> entries = new List <Pair>(); foreach (Book key in dictionary.Keys) { entries.Add(new Pair(key, dictionary.GetBookCopyList(key))); } XmlSerializer serializer = new XmlSerializer(typeof(List <Pair>)); serializer.Serialize(writer, entries); }
public NewBookForm(BookDictionary books) { InitializeComponent(); this.books = books; }