I just stumbled over this in some C# code...:
public Foo Foo { get; private set; }
How can I do the same thing in vb?
I just stumbled over this in some C# code...:
public Foo Foo { get; private set; }
How can I do the same thing in vb?
Of course (smacks forehead)...:
Public Property Foo() As Foo
Get
...
End Get
Private Set(ByVal value As Foo)
...
End Set
End Property
I did not think about putting the private keyword down there...
VB.NET does not have automatic properties like C# 3.0 does. In VB the equivalent would be:
Private _Foo As SomeType
Public Property Foo() As SomeType
Get
Return _Foo
End Get
Private Set(ByVal value As SomeType)
_Foo = value
End Set
End Property