Earlier this year the C# team implemented a change in the design of anonymous types. It used to be possibly to create an anonymous type and then change a property on the anonymous type. The code would look like this:
var x = new { Name = "Mark", Age = 0 };x.Age = 35;
In Visual Studio 2008 beta 2 this is however no longer possible since anonymous types are now immutable. There are apparently good reasons for doing this and Sree explains it in this post and there is an issue on MSConnect where Mads from the C# team explains the reasoning. Must say I don't completely get the reasoning, especially since VB.NET does not have this restriction.
dasBlog theme by Mads Kristensen
Concepts LINQ Entity Framework WCF WPF RESTful Web Unit Testing .NET Workflow More >>
Tools Visual Studio Windows IIS Silverlight More >>
Type Screencast Tools Video Newsletter Sample Article Books Magazine How To Demo Course Products More >>