VB.NET Equivalent of this code

女生的网名这么多〃 提交于 2019-11-30 12:08:14

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
Public Overridable Property Comments() As ICollection(Of Comment)
 Public Overridable Property Comments() As ICollection(Of Comment)
     Get
    Return m_Comments
    End Get
     Set
    m_Comments = Value
    End Set
 End Property
 Private Overridable m_Comments As ICollection(Of Comment)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!