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:
827 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Persistence.Core;
|
---|
3 | using HeuristicLab.Persistence.Interfaces;
|
---|
4 | using System.Text;
|
---|
5 | using System.Text.RegularExpressions;
|
---|
6 | using System.Globalization;
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Persistence.Default.Xml.Primitive {
|
---|
10 |
|
---|
11 | internal sealed class Guid2XmlSerializer : PrimitiveXmlSerializerBase<Guid> {
|
---|
12 |
|
---|
13 | public override XmlString Format(Guid o) {
|
---|
14 | return new XmlString(o.ToString("D", CultureInfo.InvariantCulture));
|
---|
15 | }
|
---|
16 |
|
---|
17 | public override Guid Parse(XmlString t) {
|
---|
18 | try {
|
---|
19 | return new Guid(t.Data);
|
---|
20 | } catch (FormatException x) {
|
---|
21 | throw new PersistenceException("Cannot parse Guid string representation.", x);
|
---|
22 | } catch (OverflowException x) {
|
---|
23 | throw new PersistenceException("Overflow during Guid parsing.", x);
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.