MethodBuilder.IsGenericMethodDefinition 属性

定义

获取一个值,该值指示当前 MethodBuilder 对象是否表示泛型方法的定义。

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

属性值

Boolean

如果当前 MethodBuilder 对象表示泛型方法的定义,则为 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)

注解

MethodBuilder只能用于创建泛型方法定义;它不能直接用于创建构造泛型方法。 但是, 的子 MethodBuilder 类可能表示构造的泛型方法。

适用于

另请参阅