Provides extension methods for type Predicate<T> and predefined predicates.
Namespace: DotNext Assembly: DotNext.dll Syntaxpublic static class Predicate
Methods | Edit this page View Source And<T>(Predicate<T>, Predicate<T>)
Returns a predicate which computes logical AND between results of two other predicates.
Declarationpublic static Predicate<T> And<T>(this Predicate<T> left, Predicate<T> right)
Parameters Type Name Description Predicate<T> left
The first predicate acting as logical AND operand.
Predicate<T> rightThe second predicate acting as logical AND operand.
Returns Type Description Predicate<T>The predicate which computes logical AND between results of two other predicates.
Type Parameters Name Description TType of the predicate argument.
| Edit this page View Source AsConverter<T>(Predicate<T>)Represents predicate as type Converter<TInput, TOutput>.
Declarationpublic static Converter<T, bool> AsConverter<T>(this Predicate<T> predicate)
Parameters Type Name Description Predicate<T> predicate
A predicate to convert.
Returns Type Parameters Name Description TType of predicate argument.
| Edit this page View Source AsFunc<T>(Predicate<T>)Represents predicate as type Func<T, TResult>.
Declarationpublic static Func<T, bool> AsFunc<T>(this Predicate<T> predicate)
Parameters Type Name Description Predicate<T> predicate
A predicate to convert.
Returns Type Parameters Name Description TType of predicate argument.
| Edit this page View Source Constant<T>(bool)Returns a predicate which always returns the specified value.
Declarationpublic static Predicate<T> Constant<T>(bool value)
Parameters Type Name Description bool value
The value to be returned by the predicate.
Returns Type Description Predicate<T>A cached predicate always returning value
.
The type of the input parameter.
| Edit this page View Source HasValue<T>()Returns predicate checking that input argument of value type is not null.
Declarationpublic static Predicate<T?> HasValue<T>() where T : struct
Returns Type Description Predicate<T?>
The predicate instance.
Type Parameters Name Description TThe type of the predicate argument.
| Edit this page View Source IsNotNull<T>()Returns predicate checking that input argument is not null.
Declarationpublic static Predicate<T> IsNotNull<T>() where T : class?
Returns Type Description Predicate<T>
The predicate instance.
Type Parameters Name Description TThe type of the predicate argument.
| Edit this page View Source IsNull<T>()Returns predicate implementing nullability check.
Declarationpublic static Predicate<T> IsNull<T>() where T : class?
Returns Type Description Predicate<T>
The predicate instance.
Type Parameters Name Description TType of predicate argument.
| Edit this page View Source IsTypeOf<T>()Gets a predicate that can be used to check whether the specified object is of specific type.
Declarationpublic static Predicate<object?> IsTypeOf<T>()
Returns Type Parameters Name Description T
The target type.
| Edit this page View Source Negate<T>(Predicate<T>)Returns a predicate which negates evaluation result of the original predicate.
Declarationpublic static Predicate<T> Negate<T>(this Predicate<T> predicate)
Parameters Type Name Description Predicate<T> predicate
The predicate to negate.
Returns Type Description Predicate<T>The predicate which negates evaluation result of the original predicate.
Type Parameters Name Description TType of the predicate argument.
| Edit this page View Source Or<T>(Predicate<T>, Predicate<T>)Returns a predicate which computes logical OR between results of two other predicates.
Declarationpublic static Predicate<T> Or<T>(this Predicate<T> left, Predicate<T> right)
Parameters Type Name Description Predicate<T> left
The first predicate acting as logical OR operand.
Predicate<T> rightThe second predicate acting as logical OR operand.
Returns Type Description Predicate<T>The predicate which computes logical OR between results of two other predicates.
Type Parameters Name Description TType of the predicate argument.
| Edit this page View Source TryInvoke<T>(Predicate<T>, T)Invokes predicate without throwing the exception.
Declarationpublic static Result<bool> TryInvoke<T>(this Predicate<T> predicate, T obj)
Parameters Type Name Description Predicate<T> predicate
The predicate to invoke.
T objThe object to compare against the criteria defined within the method represented by this delegate.
Returns Type Description Result<bool>true if obj
meets the criteria defined within the method represented by this delegate; otherwise, false.
The type of the object to compare.
| Edit this page View Source Xor<T>(Predicate<T>, Predicate<T>)Returns a predicate which computes logical XOR between results of two other predicates.
Declarationpublic static Predicate<T> Xor<T>(this Predicate<T> left, Predicate<T> right)
Parameters Type Name Description Predicate<T> left
The first predicate acting as logical XOR operand.
Predicate<T> rightThe second predicate acting as logical XOR operand.
Returns Type Description Predicate<T>The predicate which computes logical XOR between results of two other predicates.
Type Parameters Name Description TType of the predicate argument.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4