using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Remember.Model { public abstract class Specification { public bool IsSatisfiedBy(T candidate) { return SatisfyingElementsFrom(new[] { candidate }).Any(); } public IEnumerable SatisfyingElementsFrom(IEnumerable candidates) { if (candidates == null) throw new ArgumentNullException("candidates"); return SatisfyingElementsFrom(candidates.AsQueryable()); } public abstract IQueryable SatisfyingElementsFrom(IQueryable candidates); } }