Nyelv

CodeTypeParameter.Constraints Tulajdonság

Definíció

Lekéri a típusparaméter korlátait.

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

Tulajdonság értéke

Egy CodeTypeReferenceCollection objektum, amely a típusparaméter korlátait tartalmazza.

Példák

Az alábbi példakód azt mutatja be, hogy a Constraints tulajdonság milyen új korlátozás hozzáadására használható. Ez a példa egy nagyobb, az CodeTypeParameter osztályhoz tartozó példa része.

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

Megjegyzések

A kényszer azt a típust határozza meg, amelyből a típusparaméternek származnia kell vagy implementálnia kell.

A következőre érvényes: