Free cookie consent management tool by TermsFeed Policy Generator

source: branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/Compact/DoubleList2XmlFormatter.cs @ 1361

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

Split all classes into their own file (#506)

File size: 743 bytes
Line 
1using System.Collections;
2using System.Collections.Generic;
3using System;
4
5namespace HeuristicLab.Persistence.Default.Xml.Compact {
6 
7  public class DoubleList2XmlFormatter : NumberEnumeration2XmlFormatter {
8
9    public override Type Type {
10      get {
11      return typeof(List<double>);
12      }
13    }
14
15    protected override void Add(IEnumerable enumeration, object o) {
16      ((List<double>)enumeration).Add((int)o);
17    }
18
19    protected override object Instantiate() {
20      return new List<double>();
21    }
22
23    protected override string formatValue(object o) {
24      return ((double)o).ToString("r");
25    }
26
27    protected override object parseValue(string o) {
28      return double.Parse(o);
29    }
30
31  }
32}
Note: See TracBrowser for help on using the repository browser.