keywords

  • Thread starter Thread starter vijaya
  • Start date Start date
V

vijaya

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,
vijaya
 
vijaya,
string @if;
string _if;

what is the differnce in the above declaration?
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).
In the declaration 'string @if;', is the word 'if' still a
keyword?
Yes.

Hope this helps
Jay
 
Back
Top