Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlSerializer.cs @ 1853

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

Fix EmptyStorableClass attributes. (#603)

File size: 763 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  public class DoubleList2XmlSerializer : NumberEnumeration2XmlSerializerBase<List<double>> {
10
11    protected override void Add(IEnumerable enumeration, object o) {
12      ((List<double>)enumeration).Add((int)o);
13    }
14
15    protected override IEnumerable Instantiate() {
16      return new List<double>();
17    }
18
19    protected override string FormatValue(object o) {
20      return ((double)o).ToString("r", CultureInfo.InvariantCulture);
21    }
22
23    protected override object ParseValue(string o) {
24      return double.Parse(o);
25    }
26
27  }
28}
Note: See TracBrowser for help on using the repository browser.