Here I have this class which is basically a data structure:
public class Config
{
public uint? Release { get; set; }
public string InstallPath { get; set; }
public uint? CheckEveryXMinutes { get; set; }
public override string ToString()
{
return $"(Release: {Release}, InstallPath: {InstallPath}, CheckEveryXMinutes {CheckEveryXMinutes})";
}
}
And I want to use this structure as property of another class like this:
public class ConfigRegistry
{
public Config Result { get; set; }
public ConfigRegistry (string registryKey)
{
Result.Release = 0;
Console.WriteLine("Read Release from registry: {0}", Result.Release);
}
}
And I'm getting an error at "Result.Release = 0" line:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
What am I doing wrong here?