c#泛型TryParse类型转换
2021-05-11 04:27
标签:wro creat val reflect pre odi public div value c#泛型TryParse类型转换 标签:wro creat val reflect pre odi public div value 原文地址:http://www.cnblogs.com/nanfei/p/7591113.htmlusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Data;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
var dt = new DataTable();
dt.Columns.Add("c1", typeof(string));
var row = dt.NewRow();
row["c1"] = "abc";
var c = getDataFromDBFielddouble>(row["c1"], 2); //返回2
var d = getDataFromDBFieldobject>(row["c1"], 2); //返回"abc"
}
private static T getDataFromDBField