locked
Difference in Property RRS feed

  • Question

  • User1655374113 posted

    Hello,

    What is the difference, if I use () when declaring a property.

    Public Property UserID() As String
          Get
            Return pUserID
          End Get
          Set(value As String)
            pUserID = value
          End Set
        End Property
        Public Property FullName As String
          Get
            Return pFullName
          End Get
          Set(value As String)
            pFullName = value
          End Set
        End Property



    Thursday, January 24, 2013 2:02 PM

Answers

  • User397347636 posted

    There's no difference - VB allows either an empty parameter list on a property declaration or none - the effect is the same.

    Also, VB allows calling a property with either no argument list or an empty argument list.

    VB also allows 'parameterized properties' which have one or more parameters, in addition to indexers.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 24, 2013 5:22 PM

All replies

  • User-689243304 posted

    please refer this

    http://www.dotnetperls.com/property-vbnet

    Thursday, January 24, 2013 2:28 PM
  • User397347636 posted

    There's no difference - VB allows either an empty parameter list on a property declaration or none - the effect is the same.

    Also, VB allows calling a property with either no argument list or an empty argument list.

    VB also allows 'parameterized properties' which have one or more parameters, in addition to indexers.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 24, 2013 5:22 PM