void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (!reader.IsEmptyElement) { reader.ReadStartElement(); reader.ReadStartElement("Items", SearchEngineNamespace.Data); var items = new List <SummaryItem>(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.LocalName == "SummaryItem") { var item = new SummaryItem(); ((System.Xml.Serialization.IXmlSerializable)item).ReadXml(reader); items.Add(item); } else { reader.Skip(); } } Items = items.ToArray(); reader.ReadEndElement(); Name = reader.ReadElementString("Name", SearchEngineNamespace.Data); Description = reader.ReadElementString("Description", SearchEngineNamespace.Data); reader.ReadEndElement(); } else { reader.Skip(); } }
/// <summary> /// Construtor padrão da classe /// </summary> /// <param name="name">Nome do sumário</param> /// <param name="description">Descrição do sumário.</param> /// <param name="items">Lista de ítens</param> public SummaryResult(string name, string description, Dictionary <string, int> items) { Name = name; Description = description; _items = new SummaryItem[items.Count]; int index = 0; foreach (KeyValuePair <string, int> newItem in items) { _items[index] = new SummaryItem(newItem); index++; } }