Click or drag to resize

CqlQueryExtensionsFirstOrDefaultTSource Method (CqlQueryTSource)

Returns a CqlQuery which after execution will return the first element of a sequence, or a default value if the sequence contains no elements. To execute this CqlQuery use Execute() method.

Namespace:  Dse.Data.Linq
Assembly:  Dse (in Dse.dll) Version: 2.9.0
Syntax
C#
public static CqlQuerySingleElement<TSource> FirstOrDefault<TSource>(
	this CqlQuery<TSource> source
)

Parameters

source
Type: Dse.Data.LinqCqlQueryTSource
The CqlQuery<TSource> to return the first element of.

Type Parameters

TSource
The type of the elements of source.

Return Value

Type: CqlQuerySingleElementTSource
a CqlQuery<TSource> which after execution will return default(TSource) if source is empty, otherwise the first element in source.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type CqlQueryTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also