Re: using of "@" before classname



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.

.



Relevant Pages

  • Re: C# confusion
    ... If you create instances of MyClass, ... you are allocating an area of memory for the data segment for each ... data members are initialised upon first reference of the class. ... static keyword; This one has been hitting me like a hammer on the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Newbie: How can I use a string value for a keyword argument?
    ... I have a class method, MyClass.foo, that takes keyword arguments. ... x = MyClass() ... my goal is simply to read a bunch of key/value pairs ... contains what you have scraped out of your .ini file, ...
    (comp.lang.python)
  • Re: Newbie: How can I use a string value for a keyword argument?
    ... I have a class method, MyClass.foo, that takes keyword arguments. ... x = MyClass() ... my goal is simply to read a bunch of key/value pairs ... I'm not quite sure what foo() is really supposed to do ... ...
    (comp.lang.python)
  • Re: Fortran 77 parser
    ... Once again I'm surprised that Sale's algorithm isn't being used (and ... "Open context" means a symbol ... must begin with a keyword. ... going to allow identifiers longer that six characters, ...
    (comp.lang.fortran)
  • Re: "as" keyword woes
    ... could be identifiers, so you could have code like: ... because the syntax precludes ambiguity, but it's the only such word ... I guess I'm -1 for full PL/1 craziness, but +1 for qualified keyword ...
    (comp.lang.python)