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