/// <summary> /// Deserialize a series of "ChildNode"s from an XmlElement as elements for a generic Dictionary. /// </summary> /// <param name="_workingObject">The "working" object to receive the dictionary elements</param> /// <param name="_parentElement">The "parent" of the XmlElements containing the individual Dictionary elements</param> /// <param name="_deserializer">The deserialization framework handing the deserialization</param> /// <returns>TRUE unless the collection is not supposed to be treated like an "interface"</returns> public bool Deserialize(CWorkingObject _workingObject, XmlElement _parentElement, CDeserializer _deserializer) { if (!ATreatAsInterface.TreatAsInterface(_deserializer)) { return(false); } var oType = _workingObject.WorkingType; if (oType == null) { oType = _deserializer.GetExpectedType(_parentElement); } if (oType == null) { throw new XDeserializationError( "When deserializing a generic collection, the actual Type of the collection could not be found."); } var expectedTypes = oType.GetGenericArguments(); if (expectedTypes.Length != NumberOfExpectedTypes) { throw new XDeserializationError("The Type '" + oType.FullName + "' has " + expectedTypes.Length + " generic arguments when it is required to have exactly " + NumberOfExpectedTypes + "."); } var collection = _workingObject.GetExistingOrCreateNew(oType); var elementName = _deserializer.GetNameForCollectionElement(); foreach (XmlElement xmlElement in GetXmlChildren(_parentElement)) { if (xmlElement.Name == elementName) { AddElementFromXml(collection, xmlElement, expectedTypes, _deserializer); } } return(true); }