Skip to content

Latest commit

 

History

History
33 lines (17 loc) · 2.35 KB

ii.22.21-genericparamconstraint-0x2c.md

File metadata and controls

33 lines (17 loc) · 2.35 KB

II.22.21 GenericParamConstraint: 0x2C

The GenericParamConstraint table has the following columns:

  • Owner (an index into the GenericParam table, specifying to which generic parameter this row refers)

  • Constraint (an index into the TypeDef, TypeRef, or TypeSpec tables, specifying from which class this generic parameter is constrained to derive; or which interface this generic parameter is constrained to implement; more precisely, a TypeDefOrRefII.24.2.6) coded index)

The GenericParamConstraint table records the constraints for each generic parameter. Each generic parameter can be constrained to derive from zero or one class. Each generic parameter can be constrained to implement zero or more interfaces.

Conceptually, each row in the GenericParamConstraint table is 'owned' by a row in the GenericParam table. All rows in the GenericParamConstraint table for a given Owner shall refer to distinct constraints.

Note that if Constraint is a TypeRef to System.ValueType, then it means the constraint type shall be System.ValueType, or one of its sub types. However, since System.ValueType itself is a reference type, this particular mechanism does not guarantee that the type is a non-reference type.

This contains informative text only.

  1. The GenericParamConstraint table can contain zero or more rows

  2. Each row shall have one, and only one, owner row in the GenericParam table (i.e., no row sharing) [ERROR]

  3. Each row in the GenericParam table shall 'own' a separate row in the GenericParamConstraint table for each constraint that generic parameter has [ERROR]

  4. All of the rows in the GenericParamConstraint table that are owned by a given row in the GenericParam table shall form a contiguous range (of rows) [ERROR]

  5. Any generic parameter (corresponding to a row in the GenericParam table) shall own zero or one row in the GenericParamConstraint table corresponding to a class constraint. [ERROR]

  6. Any generic parameter (corresponding to a row in the GenericParam table) shall own zero or more rows in the GenericParamConstraint table corresponding to an interface constraint. [ERROR]

  7. There shall be no duplicate rows based upon Owner+Constraint [ERROR]

  8. Constraint shall not reference System.Void. [ERROR]

End informative text.