Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/DateTime2XmlFormatter.cs @ 1564

Last change on this file since 1564 was 1564, checked in by epitzer, 15 years ago

Stronger typing for formatters with the help of generics. Separate format and serial data type. (#548)

File size: 513 bytes
Line 
1using System;
2using HeuristicLab.Persistence.Core;
3using HeuristicLab.Persistence.Interfaces;
4
5namespace HeuristicLab.Persistence.Default.Xml.Primitive {
6
7  [EmptyStorableClass]
8  public class DateTime2XmlFormatter : FormatterBase<DateTime, XmlString> {   
9   
10    public override XmlString Format(DateTime dt) {
11      return new XmlString(dt.Ticks.ToString());     
12    }
13
14    public override DateTime Parse(XmlString x) {
15      return new DateTime(long.Parse(x.Data));
16    }
17
18  }
19
20 
21}
Note: See TracBrowser for help on using the repository browser.