Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/IO/GenericFormatter.cs @ 4068

Last change on this file since 4068 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 1.1 KB
Line 
1using System.IO;
2using System.Runtime.Serialization;
3
4namespace Netron.Diagramming.Core {
5  /// <summary>
6  /// Generic implementation of the <see cref="IGenericFormatter"/> interface.
7  /// </summary>
8  /// <typeparam name="F"></typeparam>
9  public class GenericFormatter<F> : IGenericFormatter where F : IFormatter, new() {
10    IFormatter m_Formatter = new F();
11
12    /// <summary>
13    /// Deserializes the specified serialization stream.
14    /// </summary>
15    /// <param name="serializationStream">The serialization stream.</param>
16    /// <returns></returns>
17    public T Deserialize<T>(Stream serializationStream) {
18      return (T)m_Formatter.Deserialize(serializationStream);
19    }
20    /// <summary>
21    /// Serializes the specified serialization stream.
22    /// </summary>
23    /// <param name="serializationStream">The serialization stream.</param>
24    /// <param name="graph">A parameter of the generics Type T</param>
25    public void Serialize<T>(Stream serializationStream, T graph) {
26      m_Formatter.Serialize(serializationStream, graph);
27    }
28  }
29
30}
Note: See TracBrowser for help on using the repository browser.