Show / Hide Table of Contents

Class PredicateUtils

Utility methods for combining predicate functions together.

Inheritance
System.Object
PredicateUtils
Namespace: Eco.Shared.Utils
Assembly: Eco.Shared.dll
Syntax
public static class PredicateUtils : Object

Methods

AndAlso<T>(Func<T, Boolean>, Func<T, Boolean>)

Combines left and right by && operator. Uses same naming as System.Linq.Expressions.Expression.AndAlso(System.Linq.Expressions.Expression,System.Linq.Expressions.Expression).

Declaration
public static Func<T, bool> AndAlso<T>(this Func<T, bool> left, Func<T, bool> right)
Parameters
Type Name Description
System.Func<T, System.Boolean> left
System.Func<T, System.Boolean> right
Returns
Type Description
System.Func<T, System.Boolean>
Type Parameters
Name Description
T

MatchesAll<T>(T, Func<T, Boolean>[])

Checks if item matches all predicates. Returns true if no predicates.

Declaration
public static bool MatchesAll<T>(this T item, params Func<T, bool>[] predicates)
Parameters
Type Name Description
T item
System.Func<T, System.Boolean>[] predicates
Returns
Type Description
System.Boolean
Type Parameters
Name Description
T

MatchesAll<TEnumerable, T>(T, TEnumerable)

Checks if item matches all predicates. Returns true if no predicates.

Declaration
public static bool MatchesAll<TEnumerable, T>(this T item, TEnumerable predicates)
    where TEnumerable : IEnumerable<Func<T, bool>>
Parameters
Type Name Description
T item
TEnumerable predicates
Returns
Type Description
System.Boolean
Type Parameters
Name Description
TEnumerable
T

MatchesAny<TEnumerable, T>(T, TEnumerable)

Checks if item matches any of predicates. Returns false if no predicates.

Declaration
public static bool MatchesAny<TEnumerable, T>(this T item, TEnumerable predicates)
    where TEnumerable : IEnumerable<Func<T, bool>>
Parameters
Type Name Description
T item
TEnumerable predicates
Returns
Type Description
System.Boolean
Type Parameters
Name Description
TEnumerable
T
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾