VB.Net Properties - Public Get, Private Set

后端 未结 6 1902
借酒劲吻你
借酒劲吻你 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:55

    If you are using VS2010 or later it is even easier than that

    Public Property Name as String
    

    You get the private properties and Get/Set completely for free!

    see this blog post: Scott Gu's Blog

提交回复
热议问题