CqlQueryExtensionsFirstOrDefaultTSource Method (TableTSource, ExpressionFuncTSource, Boolean) |
Returns a CqlQuery which after execution will return the first element of the sequence that satisfies a condition
or a default value if no such element is found.
To execute this CqlQuery use Execute() method.
Namespace: Dse.Data.LinqAssembly: Dse (in Dse.dll) Version: 2.3.0
Syntax public static CqlQuerySingleElement<TSource> FirstOrDefault<TSource>(
this Table<TSource> source,
Expression<Func<TSource, bool>> predicate
)
Parameters
- source
- Type: Dse.Data.LinqTableTSource
The Table<TSource> to return the first element of. - predicate
- Type: System.Linq.ExpressionsExpressionFuncTSource, Boolean
A function to test each element for a condition.
Type Parameters
- TSource
- The type of the elements of source.
Return Value
Type:
CqlQuerySingleElementTSourcea CqlQuery<TSource> which after execution will return
default(TSource) if source is empty
or if no element passes the test specified by predicate,
otherwise the first element in source that passes the test specified by predicate.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
TableTSource. 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