WARNING: This is a speculative post. Caveat emptor.
I apologize for the long silence, things have been a little busy around Panopticon Central these days! Anyway, I wanted to go back to talking about some of the things that we’re thinking about for the next version, and I thought I’d go over a small one: automatically implemented properties. As the name implies, these would be basically the same thing you get in C# 3.0’s auto-implemented properties.
What we’re talking about is allowing you to have a simple property declaration like so:
Public Property x() As Integer
This would generally expand under the covers to look something like this:
Private _x As Integer Public Property x() As Integer Get Return _x End Get Set(ByVal value As Integer) _x = value End Set End Property
The one major difference that we’re considering from C#’s auto-implemented properties is to allow initializers on the auto-implemented property. In other words, something like:
Public Property x As Integer = 10 Public Property y As New List(Of Integer)()
I think C# also doesn’t let you bind to the underlying field, but just like with other auto-generated stuff in VB, I think we’d err on the side of allowing you to bind to it if you really needed to. You can also make them Overridable if you like, to allow derived classes to provide their own implementation.
Just a little feature, but one that can be useful.