Alex Rivera | Logout

what's the meaning of the brackets in Property definition?

Asked 2012-04-16T12:43:09.560
10

What is the meaning of the square brackets around the name of a property in the definition ?

Example :

Public Property [Date] As String 
Edit
Report

1 Answer

11

To use reserved keywords as identifiers, the brackets must be used to distinguish between the identifier and the keyword:

dim [String] As String

public sub [Stop]
end sub

On msdn it says:

Any program element — such as a variable, class, or member — can have the same name as a restricted keyword. For example, you can create a variable named Loop. However, to refer to your version of it — which has the same name as the restricted Loop keyword — you must either qualify it by preceding it with its full namespace, or enclose it in square brackets ([ ]), as in the following examples:

Reference here

answered 2012-04-16T12:46:48.297

Your Answer