I define a class property algorithm as follows:
public InputParametersProperty InputParameters { get; set; }
public class InputParametersProperty
{
private Dictionary<string, object> inputParameters = new Dictionary<string, object>();
public object this[string name]
{
get { return inputParameters[name]; }
set
{
if (inputParameters == null)
inputParameters = new Dictionary<string, object>();
else
inputParameters.Add(name, value);
}
}
}
From another class I want to use the property of the form:
algorithm.InputParameters["populationSize"] = 100;
But I get the error: Object reference not set to an instance of an object