If the rules you are referring to should map to actions, then you can have a class like this:
interface IRule<T>
{
void Apply(T obj);
}
class PredicateRule<T> : IRule<T>
{
public ActionRule(Func<T, bool> p, Action<T> a)
{
this.predicate = p;
this.action = a;
}
readonly Func<T, bool> predicate;
readonly Action<T> action;
public void Apply(T obj)
{
if (this.predicate(obj))
this.action(obj);
}
}
So then your "if xyz = 5 then .." rule could be declared like this:
var r = new PredicateRule<XyzClass>(x => x == 5, x => { //then... });