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

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

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