var t = p.PropertyType;
var obj = new object();
var value = row[p.Name].ToString();
// 解决 nullable long ?转换错误
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))
{
if (string.IsNullOrEmpty(value))
obj = null;
else
obj=Convert.ChangeType(value, Nullable.GetUnderlyingType(t));
//obj = Convert.ChangeType(value, t.GetGenericArguments()[0]);
dynmicValue = System.ComponentModel.TypeDescriptor.GetConverter(prop.PropertyType).ConvertFromString(value.ToString());
}
else
{
obj = Convert.ChangeType(value, p.PropertyType);//类型强转,将table字段类型转为集合字段类型
}