SqlSet.FirstOrDefault(String, Object[]) Method

Returns the first element of the set that satisfies a condition or a default value if no such element is found.

Namespace: DbExtensions
Assembly: DbExtensions.dll

Overloads

  Name Description
Public method FirstOrDefault() Returns the first element of the set, or a default value if the set contains no elements.
Public method FirstOrDefault(String, Object[]) Returns the first element of the set that satisfies a condition or a default value if no such element is found.

Syntax

public Object FirstOrDefault(
	string predicate,
	params Object[] parameters
)

Parameters

predicate  String

A SQL expression to test each row for a condition.

parameters  Object[]

The parameters to apply to the predicate.

Return Value

Object
A default value if the set is empty or if no element passes the test specified by predicate; otherwise, the first element that passes the test specified by predicate.

See Also

Reference

SqlSet Class
DbExtensions Namespace

© Max Toro Q.