Resolved syntax question: "Public Property [row]() As String" what are [] and () for?

Flippedbeyond

Well-known member
Joined
Dec 19, 2008
Messages
198
Programming Experience
1-3
syntax question: "Public Property [row]() As String" what are [] and () for?

small, not important question, but its been bugging me. I saw this in someones code, can somebody please explain what the []() syntax does? thanks

Public Property [row]() As String 'is []() just optional syntax?
'from my own testing it is equivalent to
Public Property row As String
 
Last edited:
The hard brackets [] around the name row tells the compiler you're not using a reserved word for the property name. The () after it means it's a string array, of which if true, you should rename it to rows to indicate it's plural otherwise remove the () to mean a single row.
 
Thanks JuggaloBrotha.

I got it now,

i did a little more testing and i also noticed that the () is just the method sig with empty parameters, because its a property, to declare it as an array the () has to be after the type

        Property row() As Integer 'not array '() is unnecessary since there are no parameters
        Property rows() As Integer() 'this is array
 
Back
Top