I have an interface
public interface IConfig
{
string name { get; set; }
string address { get; set; }
int phone { get; set; }
List<string> children { get; set; }
}
Here is my config file that has only three app settings not four like i have in interface.
<add key="name" value="abc" />
<add key="address" value="100 Norin Street" />
<add key="phone" value="709-111-111111" />
Now on startup I am using DictionaryAdapterFactory to fillin the app.config file values. I am successfully getting values of app.config here.
private readonly IConfig _config;
private readonly DictionaryAdapterFactory _factory;
_factory = new DictionaryAdapterFactory();
_config = _config.GetAdapter<IConfig>(ConfigurationManager.AppSettings);
now at run time I need to fill in the value of children which is List type. But i am getting null exception. Why?
//loop
_config.children.Add(item.values);
What is the problem here?