Last change
on this file since 4019 was
2768,
checked in by mkommend, 15 years ago
|
added solution folders and sources for the netron library (ticket #867)
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 | using System.IO;
|
---|
5 | using System.Runtime.Serialization.Formatters.Binary;
|
---|
6 | using System.Runtime.Serialization;
|
---|
7 |
|
---|
8 | namespace Netron.Diagramming.Core
|
---|
9 | {
|
---|
10 | /// <summary>
|
---|
11 | /// Generic implementation of the <see cref="IGenericFormatter"/> interface.
|
---|
12 | /// </summary>
|
---|
13 | /// <typeparam name="F"></typeparam>
|
---|
14 | public class GenericFormatter<F> : IGenericFormatter where F : IFormatter, new()
|
---|
15 | {
|
---|
16 | IFormatter m_Formatter = new F();
|
---|
17 |
|
---|
18 | /// <summary>
|
---|
19 | /// Deserializes the specified serialization stream.
|
---|
20 | /// </summary>
|
---|
21 | /// <param name="serializationStream">The serialization stream.</param>
|
---|
22 | /// <returns></returns>
|
---|
23 | public T Deserialize<T>(Stream serializationStream)
|
---|
24 | {
|
---|
25 | return (T) m_Formatter.Deserialize(serializationStream);
|
---|
26 | }
|
---|
27 | /// <summary>
|
---|
28 | /// Serializes the specified serialization stream.
|
---|
29 | /// </summary>
|
---|
30 | /// <param name="serializationStream">The serialization stream.</param>
|
---|
31 | /// <param name="graph">A parameter of the generics Type T</param>
|
---|
32 | public void Serialize<T>(Stream serializationStream, T graph)
|
---|
33 | {
|
---|
34 | m_Formatter.Serialize(serializationStream, graph);
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.