Why can I create a class named “var”?
问题 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 ? 回答1: var is not a