linq集合内部赋值
比如将一个列的值,赋值给另一列
有三种方法:
1. e.Result.ToList().ForEach(n => n.IsIntermediarybool = SetIsIntermediary(n.IsIntermediary));
2.e.Result.Select(n => n.IsIntermediarybool = SetIsIntermediary(n.IsIntermediary)).ToList();//必须是tolist否则的话不好用
3.e.Result.Select(n => { n.IsIntermediarybool = SetIsIntermediary(n.IsIntermediary); return n; }).ToList();//必须是tolist否则的话不好用
private bool SetIsIntermediary(int IsIntermediary)
{
if (IsIntermediary == 0)
return false;
else return true;
}