MethodBuilder.IsGenericMethod 属性

定义

获取一个值,该值指示方法是否为泛型方法。

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

属性值

如果该方法是泛型方法,则为 true;否则为 false

示例

下面的代码示例显示方法的状态。 此代码是为 方法提供的更大示例的 DefineGenericParameters 一部分。

// Use the IsGenericMethod property to find out if a
// dynamic method is generic, and IsGenericMethodDefinition
// to find out if it defines a generic method.
Console::WriteLine("Is SampleMethod generic? {0}",
    sampleMethodBuilder->IsGenericMethod);
Console::WriteLine(
    "Is SampleMethod a generic method definition? {0}",
    sampleMethodBuilder->IsGenericMethodDefinition);
// Use the IsGenericMethod property to find out if a
// dynamic method is generic, and IsGenericMethodDefinition
// to find out if it defines a generic method.
Console.WriteLine("Is DemoMethod generic? {0}",
    demoMethod.IsGenericMethod);
Console.WriteLine("Is DemoMethod a generic method definition? {0}",
    demoMethod.IsGenericMethodDefinition);
' Use the IsGenericMethod property to find out if a
' dynamic method is generic, and IsGenericMethodDefinition
' to find out if it defines a generic method.
Console.WriteLine("Is DemoMethod generic? {0}", _
    demoMethod.IsGenericMethod)
Console.WriteLine("Is DemoMethod a generic method definition? {0}", _
    demoMethod.IsGenericMethodDefinition)

注解

如果方法具有类型参数,则为泛型方法。 可以通过调用 DefineGenericParameters 方法来添加类型参数,使方法泛型。 无法撤消此更改。

适用于

另请参阅