MethodBuilder.IsGenericMethodDefinition 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會得到一個值,表示目前 MethodBuilder 物件是否代表一般方法的定義。
public:
virtual property bool IsGenericMethodDefinition { bool get(); };
public override bool IsGenericMethodDefinition { get; }
member this.IsGenericMethodDefinition : bool
Public Overrides ReadOnly Property IsGenericMethodDefinition As Boolean
屬性值
true 如果當前 MethodBuilder 物件代表一般方法的定義;否則, 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)
備註
A MethodBuilder 只能用來建立通用方法定義;無法直接用來建立構造化的通用方法。 然而,的 MethodBuilder 子類可能代表一個構造化的泛型方法。