VB.NET equivalent of C# property shorthand?

后端 未结 3 2040
一向
一向 2020-12-01 03:12

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

public string FirstName { get; set; }

I know you can do

Public Property name() As          


        
3条回答
  •  半阙折子戏
    2020-12-01 03:49

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

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

    public property FirstName as String
    

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

    See also: Auto-Implemented Properties (Visual Basic)

提交回复
热议问题