Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/09 14:15:22 (15 years ago)
Author:
epitzer
Message:

XML formatters for all primitive numeric types. (#548)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Double2XmlFormatter.cs

    r1454 r1554  
    11using System;
    2 using System.Globalization;
    32using HeuristicLab.Persistence.Core;
    43using HeuristicLab.Persistence.Interfaces;
     4using System.Reflection;
     5using System.Globalization;
    56
    6 namespace HeuristicLab.Persistence.Default.Xml.Primitive {
    7 
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
     8   
    89  [EmptyStorableClass]
    9   public class Double2XmlFormatter : IFormatter {   
    10 
    11     public Type Type { get { return typeof(double); } }
    12     public IFormat Format { get { return XmlFormat.Instance; } }
    13 
    14     public object DoFormat(object o) {
    15       return ((double)o).ToString("r", CultureInfo.InvariantCulture);     
    16     }
    17 
    18     public object Parse(object o) {
    19       return double.Parse((string)o, CultureInfo.InvariantCulture);
    20     }
    21 
    22   }
     10  public class Double2XmlFormatter : DecimalNumber2XmlFormatterBase<double> { }
    2311 
    2412}
Note: See TracChangeset for help on using the changeset viewer.