I have a method that uses RangeAttributes to specify valid parameter values, for example:
public MyMethod(
[Range(10, 20)] int Param1,
[Range(40, 50)] int Param2,
[Range(1, 3)] int Param3
)
{
...
}
Using reflection (say I don't know the parameter names or specified ranges in advance), I'd like to call this method for all combinations of valid parameter values, i.e. I'd like to do something equivalent to the following, but have the invocations generated dynamically based on the range attributes:
MyMethod(10, 40, 1);
MyMethod(10, 40, 2);
MyMethod(10, 40, 3);
MyMethod(10, 41, 1);
MyMethod(10, 41, 2);
MyMethod(10, 41, 3);
MyMethod(10, 42, 1);
...
Ideally I'd also like to be able to work with different methods with varying number of parameters. I'm struggling to figure out how I might code this..
Aucun commentaire:
Enregistrer un commentaire