PivotalTrackerAPI/Util/SerializationHelper.cs
/// <summary>
/// Serializes an Xml string to an instance object of type T
/// </summary>
/// <typeparam name="T">The Type of object</typeparam>
/// <param name="xmlString">string to read</param>
Serializes an Xml string to an instance object of type T
Serializes an Xml string to an instance object of type T
public static T DeserializeFromXmlString<T>(String xmlString)
    {
      XmlSerializer deserializer = new XmlSerializer(typeof(T));
      StringReader stringReader = new StringReader(xmlString);
      T retVal = default(T);
      try
      {
        retVal = (T)deserializer.Deserialize(stringReader);
      }
      finally
      {
        if (stringReader != null)
          stringReader.Close();
      }
      return retVal;
    }
public static T DeserializeFromXmlString < T > ( String xmlString ) { XmlSerializer deserializer = new XmlSerializer ( typeof ( T ) ) ; StringReader stringReader = new StringReader ( xmlString ) ; T retVal = default ( T ) ; try { retVal = ( T ) deserializer . Deserialize ( stringReader ) ; } finally { if ( stringReader != null ) stringReader . Close ( ) ; } return retVal ; }
Serializes an Xml string to an instance object of type T
Serializes an Xml string to an instance object of type T
xmlString
String
string to read
string to read
typeparam
The Type of object
The Type of object