Order of injection

Apr 16, 2008 at 8:13 PM
I think the order for injection is

1. Constructor
2. Property
3. Method

in case if i have 2 property dependency in what order they will be injected

Dependency
public ILogger Logger
{
set{ logger_ = value;}
}

Dependency
public int calculate
{
set{ //do some work; log exception using logger.log()} //logger injection should be called prior to Calculate
}
Apr 17, 2008 at 3:34 AM
The order of property injection is officially indeterminate. With the default policies, they're injected in the order that the reflection API returns them. That order should not be depended on.