CodeTypeParameter.Constraints プロパティ

定義

型パラメーターの制約を取得します。

public:
 property System::CodeDom::CodeTypeReferenceCollection ^ Constraints { System::CodeDom::CodeTypeReferenceCollection ^ get(); };
public System.CodeDom.CodeTypeReferenceCollection Constraints { get; }
member this.Constraints : System.CodeDom.CodeTypeReferenceCollection
Public ReadOnly Property Constraints As CodeTypeReferenceCollection

プロパティ値

型パラメーターの制約を含む CodeTypeReferenceCollection オブジェクト。

次のコード例は、 プロパティを使用 Constraints して新しい制約を追加する方法を示しています。 この例は、 クラスに対して提供されるより大きな例の CodeTypeParameter 一部です。

kType.Constraints.Add(new CodeTypeReference(typeof(IComparable)));
kType.Constraints.Add(New CodeTypeReference(GetType(IComparable)))

注釈

制約は、型パラメーターが派生または実装する必要がある型を指定します。

適用対象