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 | |
---|
1 | using System.Collections;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System;
|
---|
4 | using HeuristicLab.Persistence.Core;
|
---|
5 | using System.Globalization;
|
---|
6 |
|
---|
7 | namespace 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.