VB.NET等效于此代码

编程入门 行业动态 更新时间:2024-10-28 18:27:33
本文介绍了VB.NET等效于此代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

此代码的VB.NET等价物是什么。

What would be the VB.NET equivalent of this code..

public virtual ICollection<Comment> Comments { get; set; }

推荐答案

VB.NET(版本10)具有自动属性就像C#。等效语法如下:

VB.NET (in version 10) has automatic properties just like C#. The equivalent syntax is as follows:

Public Overridable Property Comments() As ICollection(Of Comment)

自动转换器往往会产生比必要语法更冗长的语法。您可以根据需要对其进行扩展,但这不是绝对必要的,除非您使用的是较早版本的编译器:

The automatic converters tend to produce syntax that is more verbose than necessary. You can expand it if you want, but it's not strictly necessary unless you're using an older version of the compiler:

Private m_Comments As ICollection(Of Comment) Public Overridable Property Comments() As ICollection(Of Comment) Get Return m_Comments End Get Set(ByVal value As ICollection(Of Comment)) m_Comments = value End Set End Property

更多推荐

VB.NET等效于此代码

本文发布于:2023-11-10 18:50:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1576163.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:于此   代码   VB   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!