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 讓方法成為泛型。 此變更無法反轉。

適用於

另請參閱