Free cookie consent management tool by TermsFeed Policy Generator

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

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

Numerous small changes, coding conventions, renames, mini refactoring (#548)

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