-
Notifications
You must be signed in to change notification settings - Fork 0
Immutable config
Piotr Szkudlarski edited this page Dec 15, 2018
·
4 revisions
Library needs to match constructor parameter with property / field and it does it as described in rule 2. below. See given example constructor parameter (testConfigurations) matches with no case sensitive comparison with property name (TestConfigurations).
Rules:
- library gets first constructor decorated by IniConstructor attribute
- library first tries to match constructor parameters with properties / fields by name with case sensitive comparison. If nothing is found library tries to compare with StringComparison.InvariantCultureIgnoreCase.
- if file does not contain value for property / field or if rule 2. does not find match library uses default value of property / field type.
public class ImmutableListOfComplexDataConfiguration
{
public IEnumerable<ImmutableConfiguration> TestConfigurations { get;}
[IniConstructor]
public ImmutableListOfComplexDataConfiguration(IEnumerable<ImmutableConfiguration> testConfigurations)
{
TestConfigurations = testConfigurations;
}
}