我有 4 个参数,我需要检查 if 条件并给出 where 条件。如何用简单的方式编写它
例子
var param1, param2, param3, param4;
If(param1 !=0 && param2==0 && param3==0 && param4==0)
{
var query = from x in xx
where x.y== param1
select x;
// where param2,param3, parma4 are 0
}
else If(param1 !=0 && param2 !=0 && param3==0 && param4==0)
{
var query = from x in xx
where x.y== param1 && x.z== param2
select x;
// where param3, parma4 are 0
}
else if .......
等等