XAML 2009将完全支持泛型、非默认构造方法、工厂方法、内建类型并且可以定义新的属性。
In XAML 2009 we see full support for generics, non-default constructors, factory methods, built-in types, and defining new properties.
因此,当类型参数t用作泛型类的超类时,T的注释确切地告知我们可以调用哪些超级构造函数。
Thus, when a type parameter t is used as the superclass of a generic class, the annotation on t tells us exactly what super-constructors we can call.
不幸的是,您不能用通配符类型的参数调用泛型构造函数,即使知道存在这样的构造函数也不行。
Unfortunately, you can't invoke a generic constructor with a wildcard type argument, even though you know such a constructor exists. However, you can do this.
因为运行时不能区分List和List(运行时都是List),用泛型类型参数标识类型的变量的构造就成了问题。
Because the runtime cannot tell a List from a List (at runtime, they're both just Lists), constructing variables whose type is identified by a generic type parameter is problematic.
泛型类型定义不可以从封闭构造的类型赋值。
A generic type definition is not assignable from a closed constructed type.
类似于泛型类的定义,但是在方法和构造中所定义的类型参数的作用域只能在定义它们的方法和构造中。
This is similar to declaring a generic type, but the type parameter's scope is limited to the method or constructor in which it's declared.
提供的类型必须公开泛型类型可以访问的无参数构造函数。
The supplied type must expose a parameterless constructor that your generic type can access.
实现接口的类型不必公开构造函数,并且受构造函数的访问级别限制,泛型类型中的代码可能无法访问该构造函数。
A type that implements interfaces does not necessarily expose a constructor, and depending on the access level of a constructor, the code within the generic type might not be able to access it.
实现接口的类型不必公开构造函数,并且受构造函数的访问级别限制,泛型类型中的代码可能无法访问该构造函数。
A type that implements interfaces does not necessarily expose a constructor, and depending on the access level of a constructor, the code within the generic type might not be able to access it.
应用推荐