LINQで動的where条件を使用する必要があるシナリオがあります。
私はこのようなものが欲しい:
public void test(bool flag)
{
from e in employee
where e.Field<string>("EmployeeName") == "Jhom"
If (flag == true)
{
e.Field<string>("EmployeeDepartment") == "IT"
}
select e.Field<string>("EmployeeID")
}
Linqクエリの途中で「If」を使用できないことは知っていますが、これに対する解決策は何ですか?
助けてください...