VB.NET等价的C#属性的简写? [英] VB.NET equivalent of C# property shorthand?

查看:218
本文介绍了VB.NET等价的C#属性的简写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有VB.NET等同于C#中的:

Is there a VB.NET equivalent to the C#:

public string FirstName { get; set; }

我知道你能行

Public Property name() As String
   Get
      Return _name.ToString
   End Get
   Set(ByVal value As String)
       _name = value
   End Set
End Property

但我似乎无法达到谷歌的回答上一个Visual Basic的简写。

But I can't seem to google up an answer on a Visual Basic shorthand.

推荐答案

有没有速记Visual Studio 2008或之前的VB.NET。

There is no shorthand for Visual Studio 2008 or prior for VB.NET.

在Visual Studio 2010和超越,你可以使用以下简写:

In Visual Studio 2010 and beyond, you can use the following shorthand:

public property FirstName as String

这将在C#中的短版处理是 - 我想他们称之为自动属性

This will be handled as your short version in C# is - I think they call it "Auto Property"

另请参阅:自动实现的属性(Visual Basic中)

这篇关于VB.NET等价的C#属性的简写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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