MethodBuilder.IsGenericMethod Vlastnost

Definice

Získá hodnotu označující, zda je metoda obecná metoda.

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

Hodnota vlastnosti

truepokud je metoda obecná; v opačném případě . false

Příklady

Následující příklad kódu zobrazí stav metody. Tento kód je součástí většího příkladu pro metodu 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)

Poznámky

Metoda je obecná, pokud má parametry typu. Metodu můžete nastavit jako obecnou tak, že zavoláte metodu DefineGenericParameters a přidáte parametry typu. Tuto změnu nelze vrátit zpět.

Platí pro

Viz také