MethodBase.IsGenericMethod MethodBase.IsGenericMethod MethodBase.IsGenericMethod MethodBase.IsGenericMethod Property

定义

获取一个值,该值指示方法是否为泛型方法。Gets a value indicating whether the method is generic.

public:
 virtual property bool IsGenericMethod { bool get(); };
public virtual bool IsGenericMethod { get; }
member this.IsGenericMethod : bool
Public Overridable ReadOnly Property IsGenericMethod As Boolean

属性值

如果当前 MethodBase 表示泛型方法,则为 true;否则为 falsetrue if the current MethodBase represents a generic method; otherwise, false.

注解

使用属性可确定当前MethodBase对象是否表示泛型方法。 IsGenericMethodUse the IsGenericMethod property to determine whether the current MethodBase object represents a generic method. 使用属性来确定当前MethodBase对象是否表示开放构造方法或封闭式构造方法。 ContainsGenericParametersUse the ContainsGenericParameters property to determine whether the current MethodBase object represents an open constructed method or a closed constructed method.

备注

默认情况下不支持泛型;如果未在false派生类中重写,则此属性返回。Generics are not supported by default; this property returns false if not overridden in a derived class. .NET Framework 版本2.0 中不支持泛型构造函数,因此,如果当前实例false的类型ConstructorInfo为,则此属性返回。Generic constructors are not supported in the .NET Framework version 2.0, so this property returns false if the current instance is of type ConstructorInfo.

下表汇总了特定于泛型方法的术语的固定条件。The following table summarizes the invariant conditions for terms specific to generic methods. 有关泛型反射中使用的其他术语(如泛型类型参数泛型类型 Type.IsGenericType ),请参见属性。For other terms used in generic reflection, such as generic type parameter and generic type, see the Type.IsGenericType property.

术语Term 固定条件Invariant condition
泛型方法定义generic method definition IsGenericMethodDefinition 属性为 trueThe IsGenericMethodDefinition property is true.
定义泛型方法。Defines a generic method. 构造方法通过MethodInfo对表示泛型方法定义MethodInfo.MakeGenericMethod的对象调用方法创建,并指定一个类型参数数组。A constructed method is created by calling the MethodInfo.MakeGenericMethod method on a MethodInfo object that represents a generic method definition, and specifying an array of type arguments.
只能对泛型方法定义调用方法。MakeGenericMethodThe MakeGenericMethod method can be called only on generic method definitions.
任何泛型方法定义都是泛型方法,但反之不成立。Any generic method definition is a generic method, but the converse is not true.
Generic Method — 泛型方法generic method IsGenericMethod 属性为 trueThe IsGenericMethod property is true.
可以是泛型方法定义、开放构造方法或封闭式构造方法。Can be a generic method definition, an open constructed method, or a closed constructed method.
开放式构造方法open constructed method ContainsGenericParameters 属性为 trueThe ContainsGenericParameters property is true.
不能调用开放构造方法。It is not possible to invoke an open constructed method.
封闭式构造方法closed constructed method ContainsGenericParameters 属性为 falseThe ContainsGenericParameters property is false.
递归检查时,该方法没有未分配的泛型参数。When examined recursively, the method has no unassigned generic parameters. 包含类型没有泛型类型参数,任何类型参数都没有泛型类型参数。The containing type has no generic type parameters, and none of the type arguments have generic type parameters.
可以调用方法。The method can be invoked.

适用于

另请参阅