static public object Xml2Object(XmlDocument xmlDoc, Type type, bool isXmlFormatterContract) { BaseXmlTransfer xmlTransfer = GetXmlTransfer(isXmlFormatterContract); return(xmlTransfer.ToObject(xmlDoc, type)); //return Deserialize(xmlDoc, type, isXmlFormatterContract); }
/// <summary> /// /// </summary> /// <param name="xml"></param> /// <param name="type"></param> /// <param name="isXmlFormatterContract">true:XmlSerializer , false:DataContractSerializer </param> /// <returns></returns> static public object Xml2Object(string xml, Type type, bool isXmlFormatterContract) { if (string.IsNullOrEmpty(xml)) { return(null); } BaseXmlTransfer transfer = GetXmlTransfer(isXmlFormatterContract); return(transfer.ToObject(xml, type)); /* * XmlDocument xmlDoc = new XmlDocument(); * xmlDoc.LoadXml(xml); * return Xml2Object(xmlDoc, type, isXmlFormatterContract); */ }