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)
{
var testVar = new var();
}
}
The var
that is used in the code is the var
class that is declared before the main
class. And the compiler doesn't even complain.
While when I do this:
public class int { }
or this:
public class true { }
The compiler said that int
or true
is a keyword and cannot be used like that. Why is it not the same with var
?