Why cant i do something like this?
This is the proerty in the logger class
public Dictionary<string, string> customProperties
{ get; set; }
This is the property in the interface…
Dictionary<string, string> customProperties
{ get; set; }
and then call it like this…
DatabaseLogger.ILogger logger = new DatabaseLogger.Logger();
logger.customProperties.Add("companyName", "Company");
logger.customProperties.Add("application", "application");
I am getting a NullReferenceExcpetion – how can I avoid it?
The only thing missing is initialization of the property – it is
nullotherwise (meaning that callingAddon it will throw aNullReferenceException).Though this might be better done in the
Loggerconstructor: