Here are the examples of the csharp api System.Predicate.Invoke(TProperty) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : ValitRule.cs
with MIT License
from valit-stack
with MIT License
from valit-stack
public IValitResult Validate(TObject @object)
{
@object.ThrowIfNull();
var property = _propertySelector.Compile().Invoke(@object);
var hasAllConditionsFulfilled = true;
foreach (var condition in _conditions)
hasAllConditionsFulfilled &= condition(@object);
if (!hasAllConditionsFulfilled)
{
return ValitResult.Success;
}
var isSatisfied = _predicate?.Invoke(property) ?? false;
var errors = _errors.Any(e => !e.IsDefault) ? _errors.Where(e => !e.IsDefault) : _errors;
return isSatisfied ? ValitResult.Success : ValitResult.Fail(errors.ToArray());
}