Isn\'t var
a keyword in C#? But why can I do this:
public class var { }
public class main
{
public static void main(string[] args)
{
Another way of looking at this: "var" as a keyword was not in the first versions of C# (unlike "int" and "true"), so you might have written some code then which had a class called "var". This was perfectly fine and legal. Then later on when "var" was added to the language, the designers were so kind as to make it a keyword only in certain contexts, so your existing var class would still work.
This is one of the real challenges of language design - how to add new features without breaking existing code, and without making the new features cumbersome to use.