-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Description
Say I have a class that only has a constructor with an optional parameter like so:
public class Foo
{
public Foo(int i = -1) { }
}
And I register it and try to resolve it:
container.Register<Foo>();
container.Resolve<Foo>();
Then TinyIoC will fail to resolve it because it doesn't think it has a value for the constructor parameter, but it could have used the default values.
It would require replacing the default parameters with explicit constructor overloads to work around this, but that may not always be possible (we may not have the code).
For info on how to reflectively invoke using the default parameter see: http://stackoverflow.com/questions/2421994/invoking-methods-with-optional-parameters-through-reflection
Worthaboutapig
Metadata
Metadata
Assignees
Labels
No labels