Tech Off Post

Single Post Permalink

View Thread: LINQ Question
  • User profile image

    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?