首页 > 代码库 > Element Operators

Element Operators

ElementAt

Returns the element at a specified index in a collection

ElementAtOrDefault

Returns the element at a specified index in a collection or a default value if the index is out of range.

First

Returns the first element of a collection, or the first element that satisfies a condition.

FirstOrDefault

Returns the first element of a collection, or the first element that satisfies a condition. Returns a default value if index is out of range.

Last

Returns the last element of a collection, or the last element that satisfies a condition

LastOrDefault

Returns the last element of a collection, or the last element that satisfies a condition. Returns a default value if no such element exists.

Single

Returns the only element of a collection, or the only element that satisfies a condition.

SingleOrDefault

Returns the only element of a collection, or the only element that satisfies a condition. Returns a default value if no such element exists or the collection does not contain exactly one element.

Element Operators