Posted By: Kathleen McGrath | Jun 12th @ 2:36 PM | 6,176 Views | 4 Comments
In this interview, Doug Rothaus, a programming writer on the Visual Studio User Education team, describes the new auto-implemented properties in Visual Basic 2010. He also demonstrates some of the code examples in his Help topic, Auto-Implemented Properties.

Kathleen McGrath
Visual Studio User Education
Rating:
0
0

The demo keeps asking to install Silverlight, even I have it installed. I clicked to install it again, but I still keep getting the prompt to install it. Running Vista Ultimate - latest updates.

I think this is a great feature in Visual Basic because you will really save lots of code and it will be very easy to replace an auto implemented property with a normal property afterwards (adding additional checks and cleanup work for setters, or implementing extra logic for getters if you change the field).

 

There is only one problem:

Very often it is better to access fields directly because you want to bypass any validation checks that my be implemented in the property someday. An example for this is the constructor where you do not have valid data yet or some other situations.

It is also good for readabilty of Code if you have your global Fields of a Class starting with a "_", while local variables in a function do not have it.

I have seen you can access the private fields directly very nicely, but there is no intellisense support for this. If you type Me._Last in the construtor there is no entry for Me._Lastname.

Microsoft Communities