What do the square brakets mean in vb.net in this variable below defining as [String]
Dim client As New WebClient()
Dim htmlCode As [String] = client.DownloadString("http://www.stackoverflow.com")
What do the square brakets mean in vb.net in this variable below defining as [String]
Dim client As New WebClient()
Dim htmlCode As [String] = client.DownloadString("http://www.stackoverflow.com")
It allows you to use a reserved word in your code. There is some mis-information about this as some examples on the MS site use square brackets where they are not needed (In the example you gave the square brackets do not do anything)
As an example I recently wanted to use
lat
andlong
as arguments to a function:This will not compile because Long is a reserved word but I can do this instead:
It's useless in your example. Brackets are there to use reserved keywords for what they aren't, for example
which will create a var named "String" (which is stupid, but...)