wkempf wrote:

SecretSoftware wrote:
Error    2    Property or indexer 'AnonymousType#1.MyAnnoymousP' cannot be assigned to -- it is read only  

Why did this became like this as we go from Beta 1 to Beta 2?

This code generated the above error

var q = from x in y
             where x.d = 1
             select new {MyAnnoymousP = x.L, x.J};

q.MyAnnoymousP = Something;

in beta 1 this was valid, but in Beta 2 it became ReadOnly. Why? Will this change? Is this a bug in Beta 2?


littleguru gave a good answer, but I'd like to point out that your code above has several bugs and won't even compile.  I realize this is example code typed on the fly, so I'm not trying to be a "code cop", but until I read the answer from littleguru I couldn't even figure out what you thought was wrong. [C]

Yes, this is only example code on the fly. I just wanted to show that when you try to reassign the q.MyAnnonmousP to a new value Something, it will cause compiler error.

I used to be able to do this in Beta 1, but now they made them immutable, and I think they should allow us to edit them like we edit strings which are immutables in .NET (Ie, when edit a value, remove old one and add new one). this way every one is happy?.