mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
608 B
26 lines
608 B
using System;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace ZeroLevel.Specification
|
|
{
|
|
[DataContract]
|
|
public class ExpressionSpecification<T>
|
|
: BaseSpecification<T>
|
|
{
|
|
[DataMember]
|
|
private Func<T, bool> _expression;
|
|
|
|
public ExpressionSpecification(Func<T, bool> expression)
|
|
{
|
|
if (expression == null!)
|
|
throw new ArgumentNullException();
|
|
else
|
|
this._expression = expression;
|
|
}
|
|
|
|
public override bool IsSatisfiedBy(T o)
|
|
{
|
|
return this._expression(o);
|
|
}
|
|
}
|
|
} |