VB.Net Properties - Public Get, Private Set

后端 未结 6 1867
借酒劲吻你
借酒劲吻你 2021-01-31 13:32

I figured I would ask... but is there a way to have the Get part of a property available as public, but keep the set as private?

Otherwise I am thinking I need two prope

6条回答
  •  不要未来只要你来
    2021-01-31 13:50

    I'm not sure what the minimum required version of Visual Studio is, but in VS2015 you can use

    Public ReadOnly Property Name As String
    

    It is read-only for public access but can be privately modified using _Name

提交回复
热议问题