using System.Collections.Generic;
using System;
public class GenericConverter
{
public static T Parse<T>(string sourceValue) where T : IConvertible
{
if (String.IsNullOrEmpty(sourceValue)) return default(T);
return (T)Convert.ChangeType(sourceValue, typeof(T));
}
public static T Parse<T>(string sourceValue, IFormatProvider provider) where T : IConvertible
{
return (T)Convert.ChangeType(sourceValue, typeof(T), provider);
}
}