1.词汇
- Features related to the type system 和类型系统有关的特性
2.例句
-
Listing shows anonymous types and implicit typing in action:
代码演示了匿名类型与隐式类型:
var jon = new { Name = "Jon", Age = 31 };
var tom = new { Name = "Tom", Age = 4 };
Console.WriteLine ("{0} is {1}", jon.Name, jon.Age);
Console.WriteLine ("{0} is {1}", tom.Name, tom.Age);
-
The second point is that we haven’t created two different anonymous types here.
第二点是我们没有在这里创建两个不同的匿名类型。
-
The variables jon and tom both have the same type because the compiler uses the property names, types, and order to work out that it can generate just one type and use it for both statements.
变量jon和tom都具有相同的类型,因为编译器使用属性名称、类型和顺序来计算出它只需生成一个类型就可用于两个语句。
-
This is done on a per-assembly basis, and makes life a lot simpler in terms of being able to assign the value of one variable to another (for example, jon = tom; would be permitted in the previous code) and similar operations.
这是在每个程序集的基础上完成的,这大大简化了代码,因为可以将一个变量的值赋给另一个变量(例如,jon=tom;在上面的代码中是允许的)和以及采取其他类似的操作。