I'm missing what/how this even compiles, and what does it try to do:
// throws null reference exception on 'get' for C1:
var c2 = new Class2 { C1 = { Value = "stg" } };
public class Class1
{
public string Value { get; set; }
}
class Class2
{
public Class1 C1 { get; set; }
}
It's obvious that the initialization should include the "new":
var c2 = new Class2 { C1 = new Class1 { Value = "stg" } };
but how is this compiling even without the "new", and what is it trying to do?