In LINQ, quantifier operators are used to returning a boolean value which shows that whether some or all elements satisfies the given condition. The Standard Query Operator supports 3 different types of quantifier operators:
The Any operator is used to check whether any element in the sequence or collection satisfy the given condition. If one or more element satisfies the given condition, then it will return true. If any element does not satisfy the given condition, then it will return false.
- It is overloaded in two different types:
- Any<TSource>(IEnumerable<TSource>): This method is used to check whether a sequence contains any elements.
- Any<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>): This method is used to check whether any element of a sequence satisfies a condition.
- It is generally used with where clause.
- It does not support query syntax in C# and VB.Net languages.
- It support method syntax in both C# and VB.Net languages.
- It present in both the Queryable and Enumerable class.
- It will throw ArgumentNullException if the given source is null.
- It does not return value instead of this it return true or false.
- The return type of this operator is System.Boolean.
Is the given sequence contain element as 10 : True Is the given sequence contain element as 'oo' : True Is the given sequence contain element as 'c' : True
Is the list contain employees data?: False
- LINQ | Quantifier Operator | Contains
- LINQ | Quantifier Operator | All
- LINQ | Set Operator | Except
- LINQ | Filtering Operator | where
- LINQ | Partition Operator | Take
- LINQ | Set Operator | Distinct
- LINQ | Set Operator | Union
- LINQ | Element Operator | Last
- LINQ | Set Operator | Intersect
- LINQ | Element Operator | First
- LINQ | Generation Operator | DefaultIfEmpty
- LINQ | Projection Operator | SelectMany
- LINQ | Grouping Operator | GroupBy
- LINQ | Sorting Operator | Reverse
- LINQ | Partition Operator | TakeWhile
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.