代码如下:

其中cbFace.Text为字段名,TableFace为表名

var PnFace = (from n in TableFace
                          select n.GetType().GetProperty(cbFace.Text).GetValue(n, null));

 如果需要将获取的结果进行强制转换可以在select后的字段前加上转换语句

            var PnFace = (from n in TableFace
                          select (double)n.GetType().GetProperty(cbFace.Text).GetValue(n, null)).ToList();

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2021-08-31
  • 2022-03-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案