Composite design pattern in C#, the pragmatic way
A simple implementation of the composite design pattern with generics.
You can deal with state and further behavior in infinite different ways. You can use a context parameter and pass that to the ExecuteRule method. Each rule is then able to modify the context. Another way is to have a return value, the return value is an aggregated AND result of all the rules. Or you can define a property in the interface that keeps the state in each IRule and you have a separate construction wich aggregates this from the composites.
These are just a few ways. There are of course infinite more way's to handle this.