public object Deserialize(System.IO.Stream stream) { object deserializeResult = null; using (var tmpXmlReader = XmlDocumentHelper.CreateXmlReader(stream)) { if (this.objectType == typeof(SafePassConfiguration)) { var tmpRootName = GetXmlName(this.objectType); var tmpRootFound = SkipToRoot(tmpXmlReader, tmpRootName); if (tmpRootFound) { deserializeResult = ReadSafePassConfiguration(tmpXmlReader); } else { System.Diagnostics.Debug.Assert(false); } } else { //var tmpSerializer = new System.Xml.Serialization.XmlSerializer(this.objectType); // TODO 未能加载文件或程序集 FileNotFoundException var tmpSerializer = System.Xml.Serialization.XmlSerializer.FromTypes(new[] { this.objectType })[0]; deserializeResult = tmpSerializer.Deserialize(tmpXmlReader); } } return(deserializeResult); }