PivotalTrackerAPI/Util/SerializationHelper.cs
/// <summary>
/// Serializes an object of type T to an Xml file
/// </summary>
/// <typeparam name="T">The Type of object</typeparam>
/// <param name="t">The object to serialize</param>
/// <param name="inFilename">File to save</param>
Serializes an object of type T to an Xml file
Serializes an object of type T to an Xml file
public static void SerializeToXmlFile<T>(T t, String inFilename)
    {
      XmlSerializer serializer = new XmlSerializer(t.GetType());
      TextWriter textWriter = new StreamWriter(inFilename);
      try
      {
        serializer.Serialize(textWriter, t);
      }
      finally
      {
        if (textWriter != null)
          textWriter.Close();
      }
    }
public static void SerializeToXmlFile < T > ( T t , String inFilename ) { XmlSerializer serializer = new XmlSerializer ( t . GetType ( ) ) ; TextWriter textWriter = new StreamWriter ( inFilename ) ; try { serializer . Serialize ( textWriter , t ) ; } finally { if ( textWriter != null ) textWriter . Close ( ) ; } }
Serializes an object of type T to an Xml file
Serializes an object of type T to an Xml file
t
T
The object to serialize
The object to serialize
inFilename
String
File to save
File to save
typeparam
The Type of object
The Type of object