Hi,
The following is from the documentation concerning a TCPClient class:
Dim responseData As [String] = [String].Empty
My question is: what do the brackets around '[String]' mean?
TIA,
Steve
In this particular case - they don't mean anything. They are simply
noise. I wish the MS samples would stop using them in these meaningless
cases since it just generates a lot of unnecessary questions...
What the brackets are supposed to do is let you use a Keyword as an
identifier. For example, many times you might want a class method named
stop...
Public Class ExampleClass
Public Sub Start()
' Do cool startup stuff
End Sub
Public Sub Stop()
' Do cool shutdown stuff
End Sub
End Sub
The problem is the above will not compile, because Stop is a VB.NET
keyword. But you can fix this easily...
Public Sub [Stop]()
...
End Sub
Now, the class will compile and can be used...
Dim ec As New ExampleClass()
ec.Start()
' do stuff
ec.Stop()
That's one simple example.
HTH