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 | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Persistence.Core;
|
---|
3 | using HeuristicLab.Persistence.Interfaces;
|
---|
4 |
|
---|
5 | namespace 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.