Last change
on this file since 1835 was
1823,
checked in by epitzer, 16 years ago
|
Namespace refactoring: rename formatters & decomposers -> primitive and composite serializers. (#603)
|
File size:
858 bytes
|
Line | |
---|
1 | using System.Collections;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System;
|
---|
4 | using HeuristicLab.Persistence.Core;
|
---|
5 | using System.Globalization;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Persistence.Default.Xml.Compact {
|
---|
9 |
|
---|
10 | [EmptyStorableClass]
|
---|
11 | public class DoubleList2XmlSerializer : NumberEnumeration2XmlSerializerBase<List<double>> {
|
---|
12 |
|
---|
13 | protected override void Add(IEnumerable enumeration, object o) {
|
---|
14 | ((List<double>)enumeration).Add((int)o);
|
---|
15 | }
|
---|
16 |
|
---|
17 | protected override IEnumerable Instantiate() {
|
---|
18 | return new List<double>();
|
---|
19 | }
|
---|
20 |
|
---|
21 | protected override string FormatValue(object o) {
|
---|
22 | return ((double)o).ToString("r", CultureInfo.InvariantCulture);
|
---|
23 | }
|
---|
24 |
|
---|
25 | protected override object ParseValue(string o) {
|
---|
26 | return double.Parse(o);
|
---|
27 | }
|
---|
28 |
|
---|
29 | }
|
---|
30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.