Note: This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4).
We\'re building a web API tha
For a larger number of optional parameters, a single parameter of Dictionary could be used with the ContainsKey method. I like this approach because it allows me to pass a List or a T individually without having to create a whole other method (nice if parameters are to be used as filters, for example).
Example (new Dictionary
public bool Method(string ParamA, Dictionary AddlParams) {
if(ParamA == "Alpha" && (AddlParams.ContainsKey("foo") || AddlParams.ContainsKey("bar"))) {
return true;
} else {
return false;
}
}