The second scenario is when a type has a initializer for a static field, in which case the compiler adds a type constructor behind the scenes.
第二种情况是,类型具有一个用于静态字段的初始值设定项,在这种情况下,编译器会在后台添加类型构造函数。
Before moving on to initializer list examples and typical usage, let's look at what is meant by type narrowing.
在研究初始化器列表示例和典型用法之前,先讨论一下什么是类型窄化。
As you saw earlier, the code for a static field initializer executes inside an implicit type constructor.
正如您在前面看到的那样,静态字段初始值设定项的代码在隐式类型构造函数的内部执行。
Whenever a particular type is required, the initializer for that type is transparently lifted into the type itself.
每当需要一个特殊类型时,该类型的初始化器就很明显地被提升成类型本身。
It's okay to use initializer lists to initialize scalar variables, and the usual rule of type narrowing applies in such cases.
可以使用初始化器列表对标量变量进行初始化,在这种情况下应用一般的类型窄化规则。
Welcome to the new auto syntax: type deduction from initializer expressions.
新的auto语法:根据初始化器(initializer)表达式推导类型。
Of initializer lists and type narrowing
初始化器列表和类型窄化(type narrowing)
If the initializer is a bytes literal, you need not specify the encoding type: Remember, bytes literals are not strings. But like strings, you can concatenate bytes.
如果初始化器是一个bytesliteral,则无须指定编码类型:请记住,bytesliteral并不是字符串。
You can create an implicitly-typed array in which the type of the array instance is inferred from the elements specified in the array initializer.
您可以建立隐含型别的阵列,在其中阵列执行个体的型别是由阵列初始设定式中指定的项目推断。
The compiler USES a variable's initializer to determine the variable's type at compile time to produce early-bound code.
编译器使用变数的初始设定式,在编译时期判断变数的型别以产生早期系结程序码。
The format you use to declare an instance of an anonymous type resembles the format you use when you declare an instance of a named type by using an object initializer.
用于声明匿名类型实例的格式类似于在使用对象初始值设定项声明命名类型实例时使用的格式。
Implicitly typed arrays, a form of array creation and initialization that infers the element type of the array from an array initializer.
数组创建和初始化的形式,它从数组初始化器推导出数组的元素类型。
The compiler USES a variable's initializer to determine the variable's type at compile time to produce early-bound code.
编译器使用变量的初始值设定项,在编译时确定变量的类型,以生成早期绑定代码。
When you create an anonymous type that contains an array, the array must be implicitly typed in the type's object initializer.
建立包含阵列的匿名型别时,在型别的物件初始设定式中阵列必须是隐含型别。
By declining to deduce a concrete type, the compiler preserves any possible application of the more general initializer list.
下降推导出一个具体类型,编译器保留的更一般的初始化列表中任何可能的应用。
When you use an object initializer to create an instance of a named type, the default constructor for the class is called, followed by initialization of designated members in the order you specify.
当您使用物件初始设定式来建立具名型别的执行个体时,会呼叫类别的预设建构函式,接著按照您指定的顺序初始化指定的成员。
This error indicates that you tried to modify an initializer in a generic type.
此错误指示您尝试在泛型类型中修改初始值设定项。
This error indicates that you tried to modify an initializer in a generic type.
此错误指示您尝试在泛型类型中修改初始值设定项。
应用推荐