public static T ConvertValue <T>(this object value) { var data = new LightDataTable(); data.AddColumn("value", typeof(T), value); data.AddRow(new object[1] { value }); return(data.Rows.First().TryValueAndConvert <T>(0, true)); }
public static object ConvertValue(this Type toType, object value) { var data = new LightDataTable(); data.AddColumn("value", toType, value); data.AddRow(new object[1] { value }); return(data.Rows.First()[0, true]); }