コード例 #1
0
        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));
        }
コード例 #2
0
        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]);
        }