What is the preferred syntax for declaring an array in VB.NET?

后端 未结 1 478
面向向阳花
面向向阳花 2021-01-29 06:08

Between the following options, which is the preferred syntax for declaring arrays in VB.NET?

  1. Dim numbers1() As Integer

    vs.

相关标签:
1条回答
  • 2021-01-29 06:33

    I'll chime in here.

    I've seen more of style 1 in code than style two, however there are some minor odd inconsistencies with syntax when it comes to properties.

    My theory is the reason the parentheses after is preferred is to make it more consistent with declaring a property that is an array

    Public Property x As Integer() 'is an array
    Public Property y() As Integer 'is NOT an array
    

    That being said...use Lists :)

    0 讨论(0)
提交回复
热议问题