Files
SourceCode/PROMS/Volian.Svg.Library/SvgXMLConverter.cs
T

16 lines
480 B
C#

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) => (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromInvariantString(value);
}
}