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
 
Mattias, could you repost the answer? I got 'Message
unavailable error' for your post.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top