Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlFormatter.cs @ 1623

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

Namespace refactoring, visibility check (#548)

File size: 847 bytes
Line 
1using System.Collections;
2using System.Collections.Generic;
3using System;
4using HeuristicLab.Persistence.Core;
5using System.Globalization;
6using HeuristicLab.Persistence.Default.Decomposers.Storable;
7
8namespace HeuristicLab.Persistence.Default.Xml.Compact {
9
10  [EmptyStorableClass]
11  public class DoubleList2XmlFormatter : NumberEnumeration2XmlFormatterBase<List<double>> {
12
13    protected override void Add(IEnumerable enumeration, object o) {
14      ((List<double>)enumeration).Add((int)o);
15    }
16
17    protected override IEnumerable Instantiate() {
18      return new List<double>();
19    }
20
21    protected override string FormatValue(object o) {
22      return ((double)o).ToString("r", CultureInfo.InvariantCulture);
23    }
24
25    protected override object ParseValue(string o) {
26      return double.Parse(o);
27    }
28
29  }
30}
Note: See TracBrowser for help on using the repository browser.