Where not in () statement with lambda

Does anyone know how we can use where not in () instructions with lambda?

this is where id in() statement public List<abc> GetList(List<string> ID) { return db.abcs.Where(a => ID.Contains(a.id)).ToList<abc>(); } 

I would like to find how the cloud will be the opposite. "where id is not in ..."

+6
source share
2 answers

Just add the not ( ! ) Operator:

 // Not In return db.abcs.Where(a => !ID.Contains(a.id)).ToList(); 
+13
source

Why not?

 return db.abcs.Where(a => ! ID.Contains(a.id)).ToList<abc>(); 
+2
source

Source: https://habr.com/ru/post/908048/


All Articles