VB.net Syntax Q: What is [String] data type?

  • Thread starter Thread starter frank
  • Start date Start date
F

frank

Hello,
I don't get what [String] stands for. Is it different
from String data type?
I saw it in the following function.

Public Shared Function IsInRole(ByVal role As [String])
As Boolean
......

Frank
 
Frank,
I don't get what [String] stands for.

Square brackets are used when you want to use a keyword as an
identifier name. For example

Dim [For] As Integer

Is it different from String data type?

No, the brackets aren't needed in that context, and the end result is
exactly the same as without them.

Some code translator that Microosft apparently used to convert C#
sample code to VB.NET used square brachets a little too often, that
seems to be why you see this more often than you'd expect.



Mattias
 
Frank,
I don't get what [String] stands for.

Square brackets are used when you want to use a keyword as an
identifier name. For example

Dim [For] As Integer

Is it different from String data type?

No, the brackets aren't needed in that context, and the end result is
exactly the same as without them.

Some code translator that Microosft apparently used to convert C#
sample code to VB.NET used square brachets a little too often, that
seems to be why you see this more often than you'd expect.



Mattias
 
One more try, I don't know why you get Message unavailable.


Frank,
I don't get what [String] stands for.

Square brackets are used when you want to use a keyword as an
identifier name. For example

Dim [For] As Integer

Is it different from String data type?

No, the brackets aren't needed in that context, and the end result is
exactly the same as without them.

Some code translator that Microosft apparently used to convert C#
sample code to VB.NET used square brachets a little too often, that
seems to be why you see this more often than you'd expect.



Mattias
 
Back
Top