By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 2,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

what [] means?

P: n/a
A.M
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?

Thanks,

Allan


Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"A.M" <IH*******@sapm123.com> schrieb
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?


None, if it works without [ ].

[ ] is only required if you use keywords as an identifier.

For example, "MyClass" is a keyword. If you wanted to use it as a class
name, you'd have to write

class [MyClass]
end class
see also:
http://msdn.microsoft.com/library/en...amesInCode.asp

http://msdn.microsoft.com/library/en...ementNames.asp

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
It's used to declare a variable with the same name as a class/keyword,
etc...
"A.M" <IH*******@sapm123.com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?

Thanks,

Allan


Nov 20 '05 #3

P: n/a
Or when referring to a class name that has the same name as a keyword. A
common example I've come across is the 'Assembly' class, which also happens
to be a VB keyword.

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:O8****************@TK2MSFTNGP12.phx.gbl...
It's used to declare a variable with the same name as a class/keyword,
etc...
"A.M" <IH*******@sapm123.com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?

Thanks,

Allan



Nov 20 '05 #4

P: n/a
A.M
So why they put ProviderType inside bracket ? It seems that they don't need
doing that.

"A.M" <IH*******@sapm123.com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?

Thanks,

Allan


Nov 20 '05 #5

P: n/a
Some people are just weird.

"A.M" <IH*******@sapm123.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So why they put ProviderType inside bracket ? It seems that they don't need doing that.

"A.M" <IH*******@sapm123.com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?

Thanks,

Allan



Nov 20 '05 #6

P: n/a
A.M

Do we have similar feature in C#?
"A.M" <IH*******@sapm123.com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am analysing a VB.NET code and i see this line of code:
Dim strCacheKey As String = [ProviderType] & "provider"

What is the role of [ ] ?

Thanks,

Allan


Nov 20 '05 #7

P: n/a
Hi Allan,

I agree with Armin's suggestion.

Also based on my experience,C# does not support such feature so far.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #8

P: n/a

""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:h9**************@cpmsftngxa06.phx.gbl...
Hi Allan,

I agree with Armin's suggestion.

What "suggestion" did armin give?
Also based on my experience,C# does not support such feature so far.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #9

P: n/a
Hi,

Comment in line.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "CJ Taylor" <[cege] at [tavayn] dit commmmm>
References: <eK**************@TK2MSFTNGP10.phx.gbl> <#i**************@TK2MSFTNGP09.phx.gbl>
<h9**************@cpmsftngxa06.phx.gbl>Subject: Re: what [] means?
Date: Thu, 15 Apr 2004 08:32:46 -0500
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <eP**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: mortonrb-2-adsl-233.mtco.com 207.179.235.234
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftn gxa10.phx.gbl!TK2MSFTNGXA0
1.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gb lXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:195575
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:h9**************@cpmsftngxa06.phx.gbl...
Hi Allan,

I agree with Armin's suggestion.

What "suggestion" did armin give?


I mean the link that Armin posts will explain how the [] is used in VB.NET.
Also based on my experience,C# does not support such feature so far.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.



Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.