このようなコードがあるとします。
using (CustomerContext db = new CustomerContext())
{
var foundCustList=db.Customers.Where(c=>c.State=='-1').ToList();//Find all the customer which State is -1
foreach(var c in foundCustList)
{
db.DeleteObject(c);
}
db.SaveChanges();//After all the customer is deleted, Commit.
}
しかし、知りたいオブジェクトのリストを簡単に削除する方法はありますか?foreach
私はリストのためにそれを一つずつ行うために使用したくありません。ありがとう。