For some reason, when I’m creating a new property in Visual Basic .NET in Visual Studio 2010, the rest of the Property (template?) doesn’t complete the basic framework of the property in the code editor. It is now treating a statement like:
Public Property Length() As Integer
Instead of completing the property as it used to (code follows), it simply goes to the next line:
Public Property Length() As Integer
Get
End Get
Set(ByVal value As Integer)
End Set
End Property
What happens now is that, if I type in the ‘End Property’ code, the name of the property will now be highlighted as an error since it doesn’t have a ‘Get’ or ‘Set’ portion.
However, when I THEN type the ‘Get’ on the line following the ‘Public Property Length() As Integer’, then the balance of the property is created in the code automatically.
I don’t know how this got changed, but would love to change it back.
Does anyone know if there’s a setting in VS2010 that addresses this, or if it’s something with the basic templates that visual studio uses for creating the basic code components?
The weird thing is that for everything else, from class declarations, structures, functions and subs, the IDE still creates the balance of the code structure correctly. The only area where it doesn’t is for Property declarations.
Thanks in advance for any assistance!
Kevin
VB.NET version 10 has auto-implemented properties.
These are a bit of syntactic sugar that for simple properties (those that only get/set values of a field and nothing else) allow you to omit the Get/Set portions and the field (these do get generated by the compiler).