VB.NET等效于此代码 [英] VB.NET Equivalent of this code

查看:77
本文介绍了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等效于此代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆