The use of the square brackets allows you to use reserved words as variable
names. For example.
Dim [String]() As Integer = {1, 2, 3}
MsgBox([String](2).ToString)
However, this is not recommended practice. The practical use of the brackets
are in situations where you have no control over the names being used such
as an SQL statement where the name of a field is a reserved word.
Regards - OHM
Herfried K. Wagner [MVP] wrote:
* Daniel Klein <da*****@aracnet.com> scripsit: In the MSDN documentation I see examples like:
Dim val As [String]() = {"a", "b", "c"}
If I remove the brackets, ie, Dim val As String(), it seems to work
the same way.
The brackets are useless in this case.
What are the brackets for? And what is the difference when they are
used/omitted? I can find no mention of this anywhere in the MSDN
docs.
<http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfVBSpec2_2.asp>
--
Best Regards - OHM
O_H_M{at}BTInternet{dot}com