LINQ extension methods – Any() vs. Where() vs. Exists()

Where returns a new sequence of items matching the predicate.

Any returns a Boolean value; there’s a version with a predicate (in which case it returns whether or not any items match) and a version without (in which case it returns whether the query-so-far contains any items).

I’m not sure about Exists – it’s not a LINQ standard query operator. If there’s a version for the Entity Framework, perhaps it checks for existence based on a key – a sort of specialized form of Any? (There’s an Exists method in List<T> which is similar to Any(predicate) but that predates LINQ.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)