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 метод для добавления параметров типа. Это изменение не может быть отменено.

Применяется к

См. также раздел