How to use auto-implemented properties in class without Get or Set in VB.NET

1 Answer

0 votes
Module Module1

    Class Test
        Public Property Name As String
        Public Property Age As Integer = 10
    End Class

    Sub Main()

        Dim o As Test = New Test()

        o.Name = "Tim"
        o.Age = 52

        Console.WriteLine(o.Name)
        Console.WriteLine(o.Age)

    End Sub

End Module


' run:
' 
' Tim
' 52

 



answered Oct 20, 2018 by avibootz
...