I wonder why it is not possible to do the following:
struct TestStruct
{
public readonly object TestField;
}
TestStruct ts = new TestStruct {
/* TestField = "something" // Impossible */
};
Shouldn't the object initializer be able to set the value of the fields ?
Because object initializer is just a short way of initializing:
is the same to (compiler will translate the above to this):