Structural Subtyping (duck typing) using type inference and anonymous types.
使用类型引用和匿名类型的结构子类型转化(动态类型)。
We followed these steps to transform listing 1's anonymous type into listing 2's named type.
按照以下步骤,将清单1中的匿名类型转换为清单2中的命名类型。
An anonymous type is constructed by the compiler and the type name is only available to the compiler.
匿名型别是由编译器所建构,只有编译器才知道型别名称。
The name of the anonymous type is compiler generated, and it may vary from compilation to compilation.
匿名类型的名称由编译器生成,并可能随编译的不同而不同。
You create a composite key as an anonymous type or named typed with the values that you want to compare.
您会将复合索引键建立成匿名型别,或是包含要比较之值的具名型别。
The inferred type may be a built-in type, an anonymous type, a user-defined type, or a type defined in the.
推断的型别可能是内建型别、匿名型别、使用者定义型别,或。
In cases where a named type and an anonymous type use the same qname, they are differentiated by the qnameScope property.
如果命名元素和匿名元素使用同样的qname,他们通过qnamescope属性来区分。
Provides an example of how to return the results of a LINQ query as a specific type instead of as an anonymous type.
提供有关如何将LINQ查询的结果作为特定类型而非匿名类型返回的示例。
ONE of the keys for getting data easily to a view is that we need to send ONE object (and not an anonymous type) to the view.
若要轻易地获取数据并将其传给视图,则其中一个关键是我们需要传递“一个”对象(而且不是匿名类型)到视图。
Your code should not use or rely on the name of an anonymous type because the name might change when a project is recompiled.
代码不应使用或依赖匿名类型的名称,因为重新编译项目时该名称可能更改。
In the example in Listing 8, we have defined what is called an anonymous type, where no explicit name is given to the complex type.
在清单8的例子中,我们定义了一个匿名类型,没有明确地命名这个复杂类型。
When you create an anonymous type that contains an array, the array must be implicitly typed in the type's object initializer.
建立包含阵列的匿名型别时,在型别的物件初始设定式中阵列必须是隐含型别。
The getQNameScope method returns the binder qnameScope property to indicate whether the schema type is a named type or an anonymous type.
getQNameScope方法返回绑定的qnameScope属性,来说明脚本类型是命名类型还是匿名类型。
Type Inference - the var keyword, which is necessary when using anonymous types, can also reduce redundancy in your other variable declarations.
类型推断—使用匿名类型时,关键字var必不可少。它还能减少你其他变量声明中的冗余。
To pass an anonymous type, or a collection that contains anonymous types, outside a method boundary, you must first cast the type to object.
若要在方法界限外传递匿名型别或包含匿名型别的集合,您必须先将型别转型为物件。
For anonymous types, the binder implementation should make sure that the returned SOAPElement always has the QName matching the defined schema type.
对于匿名类型,绑定实现应该确保返回的SOAPElement的QName 与定义的脚本类型匹配。
Only properties you designate as key properties participate in tests of equality between anonymous type instances, or calculation of hash code values.
如果两个执行个体只宣告非索引键属性,但名称、型别、顺序和值都相等,则这两个执行个体还是不相等。
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to first explicitly define a type.
匿名型别提供便利的方式将唯读属性集封装至单一物件,而不用先明确定义型别。
If you must store your query results or pass them outside the method boundary, consider using an ordinary named struct or class instead of an anonymous type.
如果您必须在方法界限外储存或传递查询结果,请考虑使用一般的具名结构或类别,而不使用匿名型别。
If you do not specify member names in the anonymous type, the compiler gives the anonymous type members the same name as the property being used to initialize them.
如果您未指定匿名型别中的成员名称,编译器会提供匿名型别成员与要对其进行初始化之属性相同的名称。
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.
用于声明匿名类型实例的格式类似于在使用对象初始值设定项声明命名类型实例时使用的格式。
The complexType within the element named "person" has no name itself, so it is anonymous. You can convert this anonymous type into a named type by following these simple steps
名为 “person” 的元素中的 complexType本身没有名称,因此它是匿名的。
For an anonymous type, the binder has to be aware of its enclosing element; therefore, SOAPElement, that is returned from serialize method, has the same QName as that of the enclosing element.
对于匿名类型,绑定必须知道它的封装元素,因此,序列方法返回的SOAPElement与封装元素具有同样的QName。
This function returns an anonymous visitor function that will jump to the next node if the node is not of the correct type.
此函数返回一个匿名访问者函数,如果节点的类型不正确,则该函数将跳转到下一个节点。
Where there is more than one instance of the type to output -- in this case, where you have two cats but one dog -- you need to collect the hashes as an anonymous array of anonymous hashes.
在需要输出一个类型的多个实例的情况下 —— 在这个示例中,有两只猫和一只狗 —— 需要以匿名散列的匿名数组的形式收集散列。
To pass this to a recursive method, the anonymous class should extend a wrapper type known to the method.
为了在递归方法中传递,匿名类应该扩展方法已知的包装器类型。
It is defined as a subclass of an anonymous in-line resource, which in turn is of type daml: Restriction.
它被定义为匿名内联资源的子类,而匿名内联资源类型又是daml: Restriction的类型。
You also need to do something similar for the type of the Quantity property: you need to create an anonymous simple type.
您还需要为Quantity属性作相似的工作:您需要建立一个匿名简单类型。
Once the anonymous member's method has been called, flow has been delegated to that method entirely. So you cannot simulate type hierarchy like this.
一旦匿名成员的方法被调用,控制流整个都被委派给了该方法。
By contrast, Listing 10 makes the type local to the definition of element Book and also makes it anonymous.
相反,清单10将该类型局部地定义到元素Book中,而且定义成匿名元素。
应用推荐