Share via


CodeTypeParameter.HasConstructorConstraint 屬性

定義

取得或設定值,指出型別參數是否具有建構函式條件約束。

public:
 property bool HasConstructorConstraint { bool get(); void set(bool value); };
public bool HasConstructorConstraint { get; set; }
member this.HasConstructorConstraint : bool with get, set
Public Property HasConstructorConstraint As Boolean

屬性值

如果型別參數具有建構函式條件約束,則為 true,否則為 false。 預設為 false

範例

下列程式代碼範例示範在判斷類型參數是否有建構函式條件約束時使用 HasConstructorConstraint 屬性。 這個範例是提供給 類別之較大範例的 CodeTypeParameter 一部分。

kType.HasConstructorConstraint = true;
kType.HasConstructorConstraint = True

備註

建構函式條件約束會向編譯程式指出類型參數會公開預設公用建構函式, (沒有參數的公用建構函式) 。

適用於