public override bool Equals(object other) { if (!(other is GenericDetail)) { return(false); } GenericDetail otherDetails = (GenericDetail)other; if (_name != otherDetails._name) { return(false); } if (_values.Count != otherDetails._values.Count) { return(false); } for (int index = 0; index < _values.Count; ++index) { if (!Equals(_values[index], otherDetails._values[index])) { return(false); } } return(true); }
private void ReadXml(XmlReadAdaptor adaptor) { const string method = "ReadXml"; while ( adaptor.ReadElement(Constants.Xml.EventDetails.EventDetailElement, true) ) { string type = adaptor.ReadAttributeString(Constants.Xml.ClassAttribute, true); object instance = null; var classInfo = new ClassInfo(type); try { instance = classInfo.CreateInstance(); } catch (Exception) { } IEventDetail eventDetail; IXmlSerializable serializable; if (instance != null) { eventDetail = instance as IEventDetail; if (eventDetail == null) throw new TypeDoesNotImplementInterfaceException(GetType(), method, instance.GetType(), typeof(IEventDetail)); serializable = instance as IXmlSerializable; if (serializable == null) throw new TypeDoesNotImplementInterfaceException(GetType(), method, instance.GetType(), typeof(IXmlSerializable)); } else { eventDetail = new GenericDetail(); serializable = eventDetail as IXmlSerializable; } if (adaptor.ReadElement()) serializable.ReadOuterXml(adaptor.XmlReader); Add(eventDetail); adaptor.ReadEndElement(); } }