Type parameter '<typeparametername>' cannot be constrained to itself: '<errormessage>'

A constraint list for a type parameter includes that same type parameter.

A constraint list on a type parameter can specify any number of interfaces and at most one class. A type argument supplied for that type parameter must implement every specified interface and inherit from the specified class. The compiler requires interfaces and classes that are already defined when it encounters a constraint list. A type parameter is not considered as a defined type until it is replaced by a suitable type argument supplied by code creating the generic type.

Error ID: BC32113

To correct this error

  1. Check the spelling of both the type parameter and the constraints in its constraint list.

  2. If there are no spelling mistakes, remove the type parameter's name from its constraint list. It cannot be constrained to itself.

See Also

Concepts

Generic Types in Visual Basic

Reference

Type List