C# LINQ — “Contains”
LINQ (Language-Integrated Query) is a set of integrated C# capabilities which allow queries against data.
Dec 16, 2021
Today’s Objective: Go over the LINQ Contains function used to search a data collection for a specific value/s.
The Contains Method:
Similar to the Any keyword, the Contains function allows for the searching of a data collection for the existence of a specific data value or condition, returning a boolean if it exists.
An Example:
Using LINQ Contains allows for the code to be simplified and reduces line count. The Contains method is a more appropriate way to find out if a collection contains a value compared to the Any method.