This commit is contained in:
22
PROMS/Volian.Svg.Library/SvgXMLConverter.cs
Normal file
22
PROMS/Volian.Svg.Library/SvgXMLConverter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user