Re: using of "@" before classname
- From: Brian Gideon <briangideon@xxxxxxxxx>
- Date: Wed, 28 May 2008 09:03:00 -0700 (PDT)
On May 28, 5:47 am, Abhi <A...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
i was looking in some code in which i found that it is using @ keyword before
class name and constructor like this
public class @MyClass
{
public @MyClass
{
}
}
can anyone please help me to know that when and why we use this keyword
before classname.
Thanks
Abhi
It allows reserved words to be used as identifiers. It's use in C# is
not that common. The reasoning behind that is that all keywords in C#
begin with a lowercase character and if you follow the .NET naming
guidelines you would make all public API identifiers begin with a
capital letter. So even if your API was developed in another language
it's still not going to be likely that you encounter an identifier-
keyword collision in C#.
It's a lot more likely that you would need to use VB.NET's equivalent
[] characters to surround identifiers since VB is not case sensitive.
For example, I could declare a class called Stop in C# not knowing
that it was a keyword in VB.NET forcing developers of VB.NET to use
[]'s if they wanted to use my class.
.
- Prev by Date: TextBox with memory
- Next by Date: Re: random sorting a collection
- Previous by thread: Re: using of "@" before classname
- Next by thread: problem with using CompareTo when having string
- Index(es):
Relevant Pages
|