加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

VB.NET是否具有与自定义访问说明符相同的C#auto属性?

发布时间:2020-12-17 07:15:44 所属栏目:百科 来源:网络整理
导读:我只是想知道在VB.Net中是否有一个相当于这种C#的简写,包括私有的setter: public string Test { get; private set; } 有人可以告诉我在VB.Net中实现这一目标的最短路径吗? 解决方法 对不起,这是VB.NET中的 not possible: Auto-implemented properties are
我只是想知道在VB.Net中是否有一个相当于这种C#的简写,包括私有的setter:

public string Test { get; private set; }

有人可以告诉我在VB.Net中实现这一目标的最短路径吗?

解决方法

对不起,这是VB.NET中的 not possible:

Auto-implemented properties are
convenient and support many
programming scenarios. However,there
are situations in which you cannot use
an auto-implemented property and must
instead use standard,or expanded,
property syntax.

You have to use expanded
property-definition syntax if you want
to do any one of the following:

  • Create properties that are WriteOnly or ReadOnly.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读