这会简化泛型方法的可用性。
返回当前构造方法的基础泛型方法定义。
CA1004:泛型方法应提供类型参数。
当看过怎样写泛型方法后,会回到这个话题。
We'll return to this issue when we look at how to write generic methods.
不支持对泛型方法自身和泛型方法体的更改。
Changes to the generic method itself or generic method body are not supported.
调用上述的泛型方法(通常在处理请求前调用该方法)。
Invoke the above generic method, which must always be called before processing the request.
单元测试可能无法将实类型传递给正在测试的泛型方法。
A unit test might not be able to pass a real type to a generic method that it is testing.
请注意,方法不会仅因为在泛型类型中声明而成为泛型方法。
Note that a method is not generic just because it is declared in a generic type.
编译器会对共用相同名称的所有泛型方法套用型别推断逻辑。
The compiler applies type inference logic to all generic methods that share the same name.
可以添加、删除或更改泛型类型的实例化或对现有泛型方法的调用。
Instantiation of a generic type or calls to existing generic methods can be added, deleted, or changed.
在重载解析步骤中,编译器仅包括类型推理取得成功的那些泛型方法。
In the overload resolution step, the compiler includes only those generic methods on which type inference succeeded.
当解析一个泛型方法的调用时,编译器将设法推断类型参数它能达到的最具体类型。
The compiler will try and infer the most specific type it can for the type parameters when resolving a call to a generic method. For example, with this generic method.
若要启用推断,泛型方法的参数签章必须包含与方法之型别参数具有相同型别的参数。
To enable inference, the parameter signature of a generic method must include a parameter that is of the same type as the type parameter for the method.
示范如何在动态模组中定义泛型方法、如何定义它的泛型型别参数,以及如何执行此方法。
Shows how to define a generic method in a dynamic module, how to define its generic type parameters, and how to execute the method.
泛型参数也可以允许在方法和构造中定义,-这时方法和构造就被称之谓泛型方法和泛型参数。
Type parameters can also be declared within method and constructor signatures to create generic methods and generic constructors.
就泛型方法来说,如果一个类型参数在方法签名中只出现一次,它很有可能是一个通配符而不是一个命名的类型参数。
In the case of generic methods, if a type parameter appears only once in the method signature, then it probably should be a wildcard rather than a named type parameter.
在下一节,我将做此工作作为递推泛型解码方法的一部分。
In the next section, I'll do just this as part of a recursive generic decoding method.
这个方法接收多个参数,包括一条sql语句和一个结果处理程序,并返回一个泛型t的对象。
This method receives several parameters, including a SQL statement and a result handler, and returns an object of generic type t.
该属性是一个简单的文本值,为类、字段、方法或变量解码泛型信息。
This attribute is a simple text value that encodes the generics information for a class, field, method, or variable.
最大的消息是调试器现在支持C# 2.0的特性,如泛型、匿名方法和迭代器……
The biggest news is that the debugger now has support for C# 2.0 features such as generics, anonymous methods and iterators ....
我们为泛型生成的IL代码已经定好了将要去选出调用的方法。
The IL we’ve generated for the generic type already has the method its going to call picked out.
在上一节,我快速完成了访问泛型信息的反射方法。
In the last section, I went through a quick run-through of the reflection methods used to access generics information.
在我的DAO实现中,我使用introductions将许多查找器方法添加到现有泛型dao类中。
In my DAO implementation, I use introductions to add a number of finder methods to my existing generic DAO class.
现在我将用这些方法构建一个解释泛型的递推处理程序。
Now I'll use those methods to build a recursive processor to interpret generics. Listing 8 gives the code for this purpose
要想在不将类载入JVM的情况下访问泛型信息,您需要一种读取存储在二进制类表示内的泛型信息的方法。
To access generics information without loading classes into the JVM, you need a way of reading the generics information stored inside the binary class representation.
处理该问题的另一种方法是:只要泛型类的运行时实例化没有包括所需构造函数,就抛出异常。
Another way of handling this problem would be to throw an exception whenever a run-time instantiation of the generic class does not include a needed constructor.
签名格式扩展了字段和方法描述符的概念,将泛型类型信息包含于其中。
The signature format extends the idea of field and method descriptors to include generic type information.
因为查找器方法是特定于每个域对象的,因此将其应用于泛型DAO的类型化接口。
Because the finder methods are specific to each domain object, they are applied to the typed interfaces of the generic DAO.
象对静态方法和类所做的那样,只要防止程序员在静态字段中引用泛型类型,情况就会好很多。
It would be much better to simply prevent the programmer from referring to generic types in static fields, as is done in the case of static methods and classes.
XAML 2009将完全支持泛型、非默认构造方法、工厂方法、内建类型并且可以定义新的属性。
In XAML 2009 we see full support for generics, non-default constructors, factory methods, built-in types, and defining new properties.
应用推荐