Free cookie consent management tool by TermsFeed Policy Generator

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

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

Format white space. (Ctrl-K, Ctrl-D) (#548)

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