每当需要一个特殊类型时,该类型的初始化器就很明显地被提升成类型本身。
Whenever a particular type is required, the initializer for that type is transparently lifted into the type itself.
新的auto语法:根据初始化器(initializer)表达式推导类型。
Welcome to the new auto syntax: type deduction from initializer expressions.
如果初始化器是一个bytesliteral,则无须指定编码类型:请记住,bytes literal并不是字符串。
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.
可以使用初始化器列表对标量变量进行初始化,在这种情况下应用一般的类型窄化规则。
It's okay to use initializer lists to initialize scalar variables, and the usual rule of type narrowing applies in such cases.
在研究初始化器列表示例和典型用法之前,先讨论一下什么是类型窄化。
Before moving on to initializer list examples and typical usage, let's look at what is meant by type narrowing.
它将为您“正确地”配置选中的模块(EJB或Web应用程序组件)并为选中的模块类型初始化和启动应用程序服务器。
It will do just "the right thing" for you to configure the selected module (EJB or Web application component), initialize and start the application server for the selected type of module.
Permissions从不实例化,它提供构建Enum类型的静态初始化器,该Enum类型可以为应用程序配置权限。
Permissions is never instantiated — it features a static initializer that builds up the enum types that configure permissions for the application.
初始化器列表和类型窄化(type narrowing)
它的图形应该为不透明类型(opaque),并且应当利用布局管理器进行初始化,该布局管理器将对图的子图进行布局。
Its figure should be opaque and should be initialized with the layout manager that will layout the diagrams' children.
通过结合对象初始化器和类型接口,我们可以生成一个简单的数据存储对象,而不需要定义相应的类或结构。清单5 - 24演示了一个例子。
By combining object initializers and type inference, we can create simple data-storage objects without needing to define the corresponding class or struct. Listing 5-24 shows an example.
这种类型的初始化参数文件可以被数据库服务器读入,但是不是由服务器写入。
This type of initialization parameter file can be read by the database server, but it is not written to by the server.
在忽略哪个构造函数被调用的情况下,为了保证类型内部的成员变量都能被初始化,使用变量初始化器是最简单的方法。
Variable initializers are the simplest way to ensure that the member variables in your type are initialized regardless of which constructor is called.
数组创建和初始化的形式,它从数组初始化器推导出数组的元素类型。
Implicitly typed arrays, a form of array creation and initialization that infers the element type of the array from an array initializer.
一个构造器是一个函数,你可以调用它实例化和初始化一个特殊的对象类型。
A constructor is a function you call to instantiate and initialize a particular type of object. You invoke a constructor with the new keyword. Here are a few examples of using constructors.
下降推导出一个具体类型,编译器保留的更一般的初始化列表中任何可能的应用。
By declining to deduce a concrete type, the compiler preserves any possible application of the more general initializer list.
针对在指定类型上定义的功能提供程序初始化任何功能连接器。
Initializes any feature connectors for the feature providers defined on the specified type.
编译器将通过初始化表达式的类型推断出变量的类型。
The compiler infers the type of the variable from the type of the initialization expression.
编译器将根据变量的初始化表达式的类型来推断变量的数据类型。
The compiler infers the data type of a variable from the type of its initialization expression.
编译器将根据变量的初始化表达式的类型来推断变量的数据类型。
The compiler infers the data type of a variable from the type of its initialization expression.
应用推荐