Using this code:
struct Foo<T1>
{
public T1 Item1 { get; private set; }
public Foo(T1 item1)
{
Item1 = item1;
}
}
I encounter this error:
Backing field for automatically implemented property 'Foo.Item1' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer.
My question is, why is the property Item1
not fully assigned after the constructor is called?
Edit: Changed set
to private set
because this question has nothing to do with mutability.