I would suggest you encapsulate the "type and args" into a specific type... then you can use a params
array of that. For example:
// TODO: Find a better name :)
public class TypeBlueprint
{
public Type Type { get; set; }
public List<object> Arguments { get; set; }
public TypeBlueprint()
{
this.Arguments = new List<object>();
}
public TypeBlueprint(Type type, params object[] arguments)
{
this.Type = type;
this.Arguments = arguments.ToList();
}
}
Then:
public ObjectMap(params TypeBlueprint[] blueprints)
And call it with:
var map = new ObjectMap(new TypeBlueprint(typeof(Foo), "x", "y", "z"),
new TypeBlueprint { Type = typeof(Bar),
Arguments = { 1, 2, 3 } });
That demonstrates using both constructor parameters and object initializers to specify the type and arguments. Use whichever is best for you.