Search code examples
vb.netautomatic-properties

VB.net automatic properties with different access level for set


In c# you can auto property a value with different level of access for the get and set . . . e.g.

public String myString
{
  get;
  private set;
}

Is there away to do that with automatic properties in vb.net or are you forced to go for the long winded implementation of properties?

e.g. I don't want to do this all the time

Dim _myString As String
Public Property MyString() As String
  Get
    Return _myString
  End Get
  Private Set(ByVal value As String)
    _myString = value
  End Set
End Property

Solution

  • According to this answer, you can't.