var dogName = "ruiky";
1.【编译器】会在编译时自动根据值的类型推断这个变量的类型;
2.变量类型不可更改;因为声明的时候已经确定类型了。
3.可用来声明匿名类;
应用场景:
表示一个LINQ查询的结果,这个结果可能是 ObjectQuery<> /
Iqueryable<> / 实体类类型的对象
1.被声明的变量是一个局部变量,而不是静态或实例字段;
2.变量必须在声明的同时被初始化;编译器要根据初始化值推断类型
3.初始化不是一个匿名函数;
4.初始化表达式不能是 null;
5.语句中只声明一次变量,声明后不能更改类型;
6.赋值的数据类型必须是可以在编译时确定的类型;