How to pass parameters as a single object?

Viewed 832

I have this example to tell you what I'm looking for:

private void myMethod(string a = "", string b = "", string c = "")
{
   // do things
}

I want to find a way where I can call that method like this:

MyParameterObject parameters = new MyParameterObject();
// b is the name of parameter
parameters.AddParameter("b", "b_value");
parameters.AddParameter("c", "c_value");
myMethod(parameters);
4 Answers
Related