Changeset 3937 for trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlSerializer.cs
- Timestamp:
- 06/21/10 18:46:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlSerializer.cs
r3913 r3937 27 27 using HeuristicLab.Persistence.Default.Xml.Primitive; 28 28 using System.Text; 29 using HeuristicLab.Persistence.Auxiliary; 29 30 30 31 namespace HeuristicLab.Persistence.Default.Xml.Compact { … … 32 33 internal sealed class DoubleList2XmlSerializer : CompactXmlSerializerBase<List<double>> { 33 34 34 private static readonly char[] separators = new char[] { ';' };35 36 35 public override XmlString Format(List<double> list) { 37 StringBuilder sb = new StringBuilder( );36 StringBuilder sb = new StringBuilder(list.Count * 3); 38 37 foreach (var d in list) { 39 38 sb.Append(Double2XmlSerializer.FormatG17(d)).Append(';'); … … 44 43 public override List<double> Parse(XmlString data) { 45 44 try { 46 var values = data.Data.Split(separators, StringSplitOptions.RemoveEmptyEntries); 47 List<double> list = new List<double>(values.Length); 48 foreach (var value in values) { 45 List<double> list = new List<double>(); 46 foreach (var value in data.Data.EnumerateSplit(';')) { 49 47 list.Add(Double2XmlSerializer.ParseG17(value)); 50 48 }
Note: See TracChangeset
for help on using the changeset viewer.