Does VB.NET support automatic getters and setters on properties?

In C# I can do this:

public string myProperty { get; private set; }

This is referred to as an "automatic getter/setter" (from what I've heard). Does VB.NET support these? So far, with my properties, all I can do is this:

Public Property myProperty As String
    Get
        Return String.Empty
    End Get
    Private Set(ByVal value As String)
        somethingElse = value
    End Set
End Property

which is extremely clunky.

So... is there a better way?

Answers


Yes.

Public Property MyProperty As String

However, you can only make it ReadOnly in VB 14 (vs 2015) or later.


It does but only from framework 4.0 (2010)

http://weblogs.asp.net/gunnarpeipman/archive/2009/11/01/net-framework-4-0-vb-net-supports-automatic-properties.aspx


Need Your Help

Centering a view in its superview using Visual Format Language

ios layout autolayout visual-format-language

I just started learning AutoLayout for iOS and had a look at Visual Format Language.

Hive External Table Skip First Row

hive cloudera

I am using Cloudera's version of Hive and trying to create an external table over a csv file that contains the column names in the first column. Here is the code that I am using to do that.