23 lines
593 B
C#
23 lines
593 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.ComponentModel;
|
|
|
|
namespace Volian.Svg.Library
|
|
{
|
|
public static class SvgXmlConverter<T> where T : class
|
|
{
|
|
public static string GetString(T myObject)
|
|
{
|
|
if (myObject == null) return null;
|
|
TypeConverter FontConverter = TypeDescriptor.GetConverter(typeof(T));
|
|
return FontConverter.ConvertToInvariantString(myObject);
|
|
}
|
|
public static T GetObject(string value)
|
|
{
|
|
TypeConverter converter = TypeDescriptor.GetConverter(typeof(T));
|
|
return (T)converter.ConvertFromInvariantString(value);
|
|
}
|
|
}
|
|
}
|