PivotalTrackerAPI/Util/SerializationHelper.cs
/// <summary>
/// Serializes an XmlDocument to an instance object of type T
/// </summary>
/// <typeparam name="T">The Type of object</typeparam>
/// <param name="xmlDocument">document to read</param>
Serializes an XmlDocument to an instance object of type T
Serializes an XmlDocument to an instance object of type T
public static T DeserializeFromXmlDocument<T>(XmlDocument xmlDocument)
    {
      XmlSerializer deserializer = new XmlSerializer(typeof(T));
      XmlNodeReader nodeReader = new XmlNodeReader(xmlDocument.DocumentElement);
      T retVal = default(T);
      try
      {
        retVal = (T)deserializer.Deserialize(nodeReader);
      }
      finally
      {
        if (nodeReader != null)
          nodeReader.Close();
      }
      return retVal;
    }
public static T DeserializeFromXmlDocument < T > ( XmlDocument xmlDocument ) { XmlSerializer deserializer = new XmlSerializer ( typeof ( T ) ) ; XmlNodeReader nodeReader = new XmlNodeReader ( xmlDocument . DocumentElement ) ; T retVal = default ( T ) ; try { retVal = ( T ) deserializer . Deserialize ( nodeReader ) ; } finally { if ( nodeReader != null ) nodeReader . Close ( ) ; } return retVal ; }
Serializes an XmlDocument to an instance object of type T
Serializes an XmlDocument to an instance object of type T
xmlDocument
XmlDocument
document to read
document to read
typeparam
The Type of object
The Type of object