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 呼び出して型パラメーターを追加します。 この変更を元に戻すことはできません。

適用対象

こちらもご覧ください