SecureDelete.Schedule.HistoryManager.SerializeHistory C# (CSharp) Method

SerializeHistory() private method

private SerializeHistory ( HistoryCategory>.Dictionary categories ) : byte[]
categories HistoryCategory>.Dictionary
return byte[]
        private byte[] SerializeHistory(Dictionary<Guid, HistoryCategory> categories)
        {
            MemoryStream stream = new MemoryStream();

            try {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(stream, categories);
                return stream.ToArray();
            }
            catch(Exception e) {
                Debug.ReportError("Error while serializing task history. Exception: {0}", e.Message);
                return null;
            }
            finally {
                if(stream != null) {
                    stream.Close();
                }
            }
        }