Last change
on this file since 1823 was
1823,
checked in by epitzer, 15 years ago
|
Namespace refactoring: rename formatters & decomposers -> primitive and composite serializers. (#603)
|
File size:
715 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Persistence.Core;
|
---|
3 | using HeuristicLab.Persistence.Interfaces;
|
---|
4 | using System.Reflection;
|
---|
5 | using System.Globalization;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Persistence.Default.Xml.Primitive {
|
---|
9 |
|
---|
10 | [EmptyStorableClass]
|
---|
11 | public class Char2XmlSerializer : PrimitiveSerializerBase<char, XmlString> {
|
---|
12 |
|
---|
13 | public override XmlString Format(char c) {
|
---|
14 | return new XmlString(new string(c, 1));
|
---|
15 | }
|
---|
16 |
|
---|
17 | public override char Parse(XmlString x) {
|
---|
18 | if (x.Data.Length != 1)
|
---|
19 | throw new PersistenceException("Invalid character format, XML string length != 1");
|
---|
20 | return x.Data[0];
|
---|
21 | }
|
---|
22 | }
|
---|
23 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.