Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Char2XmlFormatter.cs @ 1853

Last change on this file since 1853 was 1853, checked in by epitzer, 15 years ago

Fix EmptyStorableClass attributes. (#603)

File size: 614 bytes
Line 
1using System;
2using HeuristicLab.Persistence.Core;
3using HeuristicLab.Persistence.Interfaces;
4using System.Reflection;
5using System.Globalization;
6
7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
8
9  public class Char2XmlSerializer : PrimitiveSerializerBase<char, XmlString> {
10
11    public override XmlString Format(char c) {
12      return new XmlString(new string(c, 1));
13    }
14
15    public override char Parse(XmlString x) {
16      if (x.Data.Length != 1)
17        throw new PersistenceException("Invalid character format, XML string length != 1");
18      return x.Data[0];
19    }
20  }
21}
Note: See TracBrowser for help on using the repository browser.