/// <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();
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
相关资源
相似解决方案