Free cookie consent management tool by TermsFeed Policy Generator

source: branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/Primitive/DateTime2XmlFormatter.cs @ 1405

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

Add empty storable class attributes to classes (#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.