/// <summary>
/// 根据列名获取列值
/// </summary>
/// <param name="colName"></param>
/// <param name="item"></param>
/// <returns></returns>
public static string ObjValue2<T>(string colName, T item) where T : new()
{
object obj = "";
Type type = typeof (T);
var proInfo = type.GetProperty(colName,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
if (proInfo != null)
{
obj = proInfo.GetValue(item, null);
}
return obj.ToString();
}
C# 根据列名获取列值
免责声明:文章转载自《C# 根据列名获取列值》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=