Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 3036 was 3036, checked in by epitzer, 14 years ago

make most serializers internal and complete API documentation (#548)

File size: 623 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  internal sealed 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.