Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Persistence.Core;
|
---|
3 | using HeuristicLab.Persistence.Interfaces;
|
---|
4 | using System.Reflection;
|
---|
5 | using System.Globalization;
|
---|
6 |
|
---|
7 | namespace 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.