CodeTypeParameter.HasConstructorConstraint 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,指出型別參數是否具有建構函式條件約束。
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
備註
建構函式條件約束會向編譯器指出類型參數會公開預設公用建構函式, (沒有參數的公用建構函式) 。