PivotalTrackerAPI/Util/SerializationHelper.cs
/// <summary>
/// Deserializes an object of type T from a binary file
/// </summary>
/// <typeparam name="T">The Type of object</typeparam>
/// <param name="inFilename">File to read</param>
Deserializes an object of type T from a binary file
Deserializes an object of type T from a binary file
public static T DeserializeFromBinaryFile<T>(String inFilename)
    {
      Stream s = null;
      IFormatter f = new BinaryFormatter();
      T retVal = default(T);
      try
      {
        s = new FileStream(inFilename, FileMode.Open);
        retVal = (T)f.Deserialize(s);
      }
      finally
      {
        if (s != null)
          s.Close();
      }
      return retVal;
    }
public static T DeserializeFromBinaryFile < T > ( String inFilename ) { Stream s = null ; IFormatter f = new BinaryFormatter ( ) ; T retVal = default ( T ) ; try { s = new FileStream ( inFilename , FileMode . Open ) ; retVal = ( T ) f . Deserialize ( s ) ; } finally { if ( s != null ) s . Close ( ) ; } return retVal ; }
Deserializes an object of type T from a binary file
Deserializes an object of type T from a binary file
inFilename
String
File to read
File to read
typeparam
The Type of object
The Type of object