In this example:
var p1 = new {Name = "A", Price = 3};
And this translates into IL:
class __Anonymous1
{
private string name ;
private int price;
public string Name{ get { return name; } set { name = value ; } }
public int Price{ get { return price; } set { price= value ; } }
}
__Anonymous1 p1 = new __Anonymous1();
p1.Name = "A";
pt.Price =3
According to IL, it is Allowed, why is it so? What is the decision behind it? Shouldn't be readonly?
Thanks
It is my first question, be gentle.