Skip to content

FirstOrDefault

Returns a single item sequence containing either the first item in the given sequence, or the default value if the sequence is empty.

Syntax

Sequence.FirstOrDefault
   ยท  [sequence]

Parameters

sequence
The sequence to return the first item from, if any.

Return Value

A sequence containing a single item.