Passing list of strings or array of strings to Unity Injection Constructor (Config-Based)
I can't seem to get the unity when I try to pass an array of strings to a list of constructor parameters when using XML config.
When I try the following:
<typeConfig ...>
<constructor ...>
<param ... parameterType="System.String[]">
<array>
<value.../>
<value.../>
</array>
</param>
</constructor>
</typeConfig>
for a c'tor that looks like this:
void Foo(string[] inputParams_){ ... }
It always fails in Unity's FindConstructor (...) method, stating that it cannot find the c'tor defining the type of the String.String parameter
Does anyone know how to successfully traverse an array of bites into this type of c'tor? If not, how can I do this with a list of strings if c'tor was to accept an IList?
Thanks!
a source to share
I usually prefer to configure Unity in code, so I cannot be helpful if config is required. But....
Typically I would use ConstructorInjector when registering:
container.Configure () .ConfigureInjectionFor (new InjectionConstructor ([value]))
But according to: Can I pass constructor parameters to Unity's Resolve () method?
Unity 2 now also includes the ability to dynamically pass parameters to the constructor at resolution time:
"container.Resolve (new ParameterOverrides {{" name "," bar "}, {" address ", 42}});"
a source to share