Why don’t VS2008 Automatic Properties Support Readonly Properties?
Visual Studio 2008 (with .Net Framework 3.5) was launched this week and I have already started working on the express edition. I did get the beta version earlier, but could not really get up and working with it cause I was occupied too much with my professional projects. Now that the final version of VS2008 is out, .Net framework has been dubbed ready by Microsoft for professional projects and I intend to spend the next few week coming to terms with the radical technical changes that have been imposed on me yet again.
I have started creating a small production-level application for one of my websites I was postponing since many days, and using it to learn the new features in VS2008.
Visual 2008 Automatic Properties
Automatic properties is a really smart idea in .Net Framwork 3.5. It reminds me of how Visual Basic 6 used to think of public variables in a class as properties. But this is definitely more professional, with a proper get; set; accessor declaration that makes things really clear. Really nifty!
Here’s a grouse. Automatic properties does not support declaration of readonly properties, you have to declare both the get; and set; accessors. Why is the limitation there? My design would have made more sense if some of my properties were declared readonly and did not have set;. Of course I can always go and declare them the traditional way, but then would it be that much fun working with .Net Framework 3.5?
Is this a limitation by intent? If yes then I would definitely love to know the reasoning. If not then I hope Microsoft provides this feature in the next update or whatever.
Let me confess here, I just can’t go to the loo without a book in hand. It’s a habit that’s stayed with me since more than a decade and a half, and the truth is, this is not going to change anywhere in the future. Lately however I’ve been wondering, why do I have to take a book to the loo. I have amassed a pretty large collection of books and articles on my PC that I wish to read, and just because they are not in print doesn’t mean that I shouldn’t be able to read them. But you really can’t take a laptop to the loo.
I won’t be surprised if you’re confused by the title. This Diwali has been confusing and revealing. The society is evolving, and so are our festivals. Some of the change is spontaneous, while the rest is motivated. Let me tell you about three unique things I noticed about this Diwali.
