Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 1454 was 1454, checked in by epitzer, 16 years ago

merge persistence exploration branch into trunk as HL plugin. (#506)

File size: 586 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 : IFormatter {   
9
10    public Type Type { get { return typeof(DateTime); } }
11    public IFormat Format { get { return XmlFormat.Instance; } } 
12
13    public object DoFormat(object o) {
14      return ((DateTime)o).Ticks.ToString();     
15    }
16
17    public object Parse(object o) {
18      return new DateTime(long.Parse((string)o));
19    }
20
21  }
22
23 
24}
Note: See TracBrowser for help on using the repository browser.