Skip to content
Eugene Sadovoi edited this page Jul 7, 2016 · 1 revision

Returns first element of the sequence

Syntax

First([predicate])

Parameters

predicate

A function to test each element for a condition. Boolean predicate(TSource)

Return Value

The first element in the sequence that passes the test in the specified predicate function.

Remarks

The First method throws an exception if no matching element is found in source. To instead return a default value when no matching element is found, use the FirstOrDefault method.

Clone this wiki locally