MethodBuilder.IsGenericMethod Свойство
Определение
Получает значение, которое указывает, является ли метод универсальным.Gets a value indicating whether the method is a generic method.
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
.true
if the method is generic; otherwise, false
.
Примеры
В следующем примере кода отображается состояние метода.The following code example displays the status of a method. Этот код является частью большого примера, приведенного для DefineGenericParameters метода.This code is part of a larger example provided for the DefineGenericParameters method.
// 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)
Комментарии
Метод является универсальным, если он имеет параметры типа.A method is generic if it has type parameters. Можно сделать метод универсальным, вызвав DefineGenericParameters метод для добавления параметров типа.You can make a method generic by calling the DefineGenericParameters method to add type parameters. Это изменение нельзя отменить.This change cannot be reversed.