私は顧客のリストを持っています:
List<customer> customerList;
Country="India" および Status="A" を持つ顧客だけを取得したいと考えています。
私はこれを試しました:
List<customer> customerList=customerList.Where(p=>p.Country.Equals("India") && p.Status.Equals("A")).ToList();
と
List<customer> customerList=customerList.Where(p=>p.Country.Equals("India")).Where(p=>p.Status.Equals("A")).ToList();
しかし、どちらも何も返しませんでした。
以下の例のように条件を分割すると、レコードは正しく取得されています。
List<customer> customerList=customerList.Where(p=>p.Country.Equals("India")).ToList();
customerList=customerList.Where(p=>p.Status.Equals("A")).ToList();
単一のクエリで AND 条件を使用してオブジェクトをフィルター処理する方法を知りたいです。
誰でも言うことができますか、どこの条件を呼び出すよりも良い方法はありますか