what [] means?

  • Thread starter Thread starter A.M
  • Start date Start date
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
 
A.M said:
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-us/vbcn7/html/vaconKeywordsAsControlNamesInCode.asp

http://msdn.microsoft.com/library/en-us/vbcn7/html/vbconElementNames.asp

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
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 said:
It's used to declare a variable with the same name as a class/keyword,
etc...


A.M said:
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
 
Some people are just weird.

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



A.M said:
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
 
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.
 
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: <[email protected]>
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: <[email protected]>
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!cpmsftngxa10.phx.gbl!TK2MSFTNGXA0
1.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:195575
X-Tomcat-NG: microsoft.public.dotnet.languages.vb


"Peter Huang" said:
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.
 
Back
Top