all groups > dotnet general > december 2003 >
You're in the

dotnet general

group:

keywords



keywords vijaya
12/28/2003 10:34:46 PM
dotnet general:

I have read that reserved words can be used as identifiers
provided that they are preceded by '@'.
But the same keyword can also be preceded by _ and used as
an identifier.For eg see the below declarations for the
keyword 'if'

string @if;
string _if;

what is the differnce in the above declaration?
In the declaration 'string @if;', is the word 'if' still a
keyword?

I needa an explanation detail
thanks in advance,
Re: keywords Jay B. Harlow [MVP - Outlook]
12/29/2003 7:53:30 AM
vijaya,
[quoted text, click to view]
The first one defines a 2 character identifier, the second defines a 3
character identifier. Which is useful when the identifier is NOT a keyword
in other languages.

Unfortunately it seems that C# does not deal with this as well as VB.NET
does. In VB.NET I can use "Me.if" to refer to the field defined, however
with C# it appears I still need the @ although the @ is not really part of
the identifier (check the IL produced using ILDASM).

[quoted text, click to view]
Yes.

Hope this helps
Jay

[quoted text, click to view]

AddThis Social Bookmark Button