LINQ Element Operators
In LINQ, element operators are used to returning the first and last element of the list or single element from the collection or a specific element based on the index value from the collection.
In LINQ, we have different types of element operators available. These are:
By using these element operators, we can get the list/collection of items at the specific position. The following table shows more detailed information related to the element operators.
||It returns the first element in sequence or from the collection based on the condition.
||It is the same as First, but it returns the default value in case when no element is found in the collection.
||It returns the last element in sequence or the last element based on the matching criteria.
||It returns an element from the list based on the specific index position.
||It is the same as ElementAt, but it returns the default value in case if no element is present at the specified index of the collection.
||It returns the single specific element from the collection.
||It is the same as Single, but it returns the default value in case if no element is found in the collection.
||It returns the default value in case if the list or collection contains empty or null values.