Darrell Norton's Blog [MVP]

Sponsors

The Lounge

Wicked Cool Jobs

News

  • Darrell Norton pic

    MVP logo

    View Darrell Norton's profile on LinkedIn

    Currently Reading:

    weewar.com

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
[Verbatim Identifiers: Part 2]

Paul Laudeman commented on my Verbatim Identifier post on how to differentiate identifiers from keywords in VB.NET.  I didn't want this to be lost in the comments section of the post, so I am reproducing his comment in its entirety.

For anyone who is interested, the way to escape keywords in Visual Basic .NET is with brackets enclosing the keyword. For example:

Public Property MyVariable as MyEnumType

Get
    Return _myVariableType
End Get

Set(ByVal Value As CalculationType)
    If (Not [Enum].IsDefined(Value.GetType, Value)) Then
        Throw New ArgumentException("Specified type is not valid.")
    End If
    _myVariableType = Value
End Set

End Property

(notice the brackets around the keyword Enum).

Maybe it's the fact that I've been buried in T-SQL for the last 3 weeks, but this is the same way T-SQL differentiates keywords from table and column names (just like the @symbol in my original post).  Is T-SQL something that Microsoft uses as the default answer to issues like this?  Or is it some overriding MS scheme?  Maybe soon we'll all be writing SELECT @variable1 = MyVariable.


Posted Mon, Aug 25 2003 8:05 PM by Darrell Norton

[Advertisement]

Devlicio.us