I have a list of Func’s in a class called ValidationMethods. I use these in a Validator class by passing them into Validator.Validate(Func). I was wondering if there is a way to wrap each func so that I can overload Validate to take an IEnumerable and specify a where class to filter based on some enum value.
I am doing this in an effort to make the API more closely follow the open / close principle where the Validator can take in more validation types as the need arises without modification of the validator.
I hope I understand you correctly. You want an enum to filter the funcs:
Then a wrapper for each func:
After that, there shouldn’t be any problem:
and so on… I hpe thats what you expected.