I'm seeing some really strange behavior (probably something obvious I'm missing) in my C# code.
The following causes an error on the TableName property. "A property without setter or inaccessible setter cannot be assigned to".
public class MyEntity
{
public IList<MyRow> Rows { get; }
public string TableName { get; }
}
Usage:
var myEntity = new MyEntity
{
Rows = { myRow },
TableName = "SomeString"
};
The error goes away if I add a set; to the TableName property. How come the Rows property doesn't need one as well?