Data Types

  • Thread starter Thread starter serban
  • Start date Start date
S

serban

Hello

What is the difference between these lines:
Private Shared s as [String]
Private Shared s as String


Thank you
serban
 
Serban,
Nothing.

In VB.NET when you want to use a keyword for an identifier you include the
keyword in square brackets. This is known as an 'Escaped Identifier'.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vblrfVBSpec2_2.asp

For example, if I wanted to create a variable named string I would use:

Private Shared [string] As String

Then when I wanted to use the variable named string:

[string] = "Hello World!"

Seeing as String is a keyword that happens to be an alias for the
System.String datatype. In your example String & [String] both refer to
System.String, so there is no difference.

Hope this helps
Jay
 
Back
Top