[ad_1]
The only thing missing is initialization of the property – it is null otherwise (meaning that calling Add on it will throw a NullReferenceException).
DatabaseLogger.ILogger logger = new DatabaseLogger.Logger();
logger.customProperties = new Dictionary<string, string>();
logger.customProperties.Add("companyName", "Company");
logger.customProperties.Add("application", "application");
Though this might be better done in the Logger constructor:
public Logger()
{
customProperties = new Dictionary<string, string>();
}
1
[ad_2]
solved Creating a property of Type Dictionary [closed]