Re: Bracketed types
- From: "Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx>
- Date: Mon, 25 May 2009 07:40:38 +0200
Mike,
No it solves things which you simply cannot do in C# which completely rely on namespaces. However, I recognize it only as sugar.
It has nothing to do with case sensitivity, by instance a public properties which are used in C# and C++ with the same names but written with different cases are in those program languages unique identifier, but they are not CLI compliant but you cannot solve this with these brackets.
However, because it can be used everywhere it can also be used in a wrong way, like in the sample you have showed
Cor
"Mike" <unknown@xxxxxxxxxx> wrote in message news:OEMpvQP3JHA.1512@xxxxxxxxxxxxxxxxxxxxxxx
Herfried K. Wagner [MVP] wrote:"Armin Zingler" <az.nospam@xxxxxxxxxx> schrieb:The _only_ reason to use them is to use a keyword as an identifier, be it a
class name or a variable name.
One exception to this rule: A type's name is the same as one of the keywords of the intrinsic types of VB, the namespace containing the custom type is imported (explicitly or implicitly), and you want to use the type without qualifying it by its namespace:
\\\
Private Sub Test()
Dim s As [String] ' Binds to the custom 'String' class.
Dim t As String ' Binds to 'System.String'.
End Sub
...
Public Class [String]
Public Value As String
End Class
///
This is my 3rd post, that wasn't posted.. hope it takes now.
I believe I understand the basic reason for it. VB is not case sensitive with identifiers. It is common practice in C/C++ and I guess C# to do things like
TYPE_NAME type_name
with clear type or variable recognition. Using brackets in VB.NET helps with this and also to address conflicts with inherited keywords, i.e. Next.
Anyway, thanks for everyone's input.
--
.
- Follow-Ups:
- Re: Bracketed types
- From: Mike
- Re: Bracketed types
- References:
- Bracketed types
- From: Mike
- Re: Bracketed types
- From: Herfried K. Wagner [MVP]
- Re: Bracketed types
- From: Mike
- Re: Bracketed types
- From: Armin Zingler
- Re: Bracketed types
- From: Mike
- Re: Bracketed types
- From: Armin Zingler
- Re: Bracketed types
- From: Herfried K. Wagner [MVP]
- Re: Bracketed types
- From: Mike
- Bracketed types
- Prev by Date: Re: Bitmap from a file
- Next by Date: Generic Function, Interface or Class
- Previous by thread: Re: Bracketed types
- Next by thread: Re: Bracketed types
- Index(es):
Relevant Pages
|