Line | |
---|
1 | using System.Collections;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Persistence.Default.Xml.Compact {
|
---|
6 |
|
---|
7 | public class DoubleList2XmlFormatter : NumberEnumeration2XmlFormatter {
|
---|
8 |
|
---|
9 | public override Type Type {
|
---|
10 | get {
|
---|
11 | return typeof(List<double>);
|
---|
12 | }
|
---|
13 | }
|
---|
14 |
|
---|
15 | protected override void Add(IEnumerable enumeration, object o) {
|
---|
16 | ((List<double>)enumeration).Add((int)o);
|
---|
17 | }
|
---|
18 |
|
---|
19 | protected override object Instantiate() {
|
---|
20 | return new List<double>();
|
---|
21 | }
|
---|
22 |
|
---|
23 | protected override string formatValue(object o) {
|
---|
24 | return ((double)o).ToString("r");
|
---|
25 | }
|
---|
26 |
|
---|
27 | protected override object parseValue(string o) {
|
---|
28 | return double.Parse(o);
|
---|
29 | }
|
---|
30 |
|
---|
31 | }
|
---|
32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.