Re: Bracketed types

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.

--





.



Relevant Pages

  • Re: Using XSLT for sending emails
    ... And where is your "ext" namespace declaration? ... N> BusinessLogic.EmailTemplate.SendEmailMessage(String emailTo, String ... N> Public Sub New ... N> Dim pr As DataAccess.DataAccessBase.ProcedureResults ...
    (microsoft.public.dotnet.general)
  • Re: Shared functions not accessible
    ... Import the Namespace. ... Public Shared MySQL as String ... Dim Cmd as New SQLCommand ... The namespace is MyFunctions and the Class is CryptoUtil. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: .NET Framework 2.0 features on VS 2005.
    ... You code will not compile, since you also used "System.IO" name space, which ... distinguish which namespace it belongs to: ... Dim crlfs() as String = ...
    (microsoft.public.dotnet.general)
  • Re: Bracketed types
    ... keywords of the intrinsic types of VB, the namespace containing the custom type is imported, and you want to ... Dim s As [String] ' Binds to the custom 'String' class. ... Using brackets in VB.NET helps with this and also to address conflicts with inherited keywords, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: XmlSerializer
    ... XmlSerializerNamespaces emptyNamespace = new XmlSerializerNamespaces; ... //Serialize the array, using the empty namespace ... > public class FormField { ... > public FormField(string Name, string Value) { ...
    (microsoft.public.dotnet.xml)