C#获取List<dynamic>动态实体值
当我们需要遍历动态一个实体想要知道某个字段有没有值时,我们可以这样来写
List<dynamic> result = conn.Query($"select * from 表 where id='123'").ToList();
foreach (KeyValuePair<string, object> col in result[0])
{
string aa = col.Key;//属性
string bb = col.Value.ToString();//值
if (!string.IsNullOrWhiteSpace(col.Value.ToString()))
{
}
}


浙公网安备 33010602011771号