Export (0) Print
Expand All
Expand Minimize

Type constraint '<expression>' is not a class or interface

A constraint list includes an expression that does not represent a valid constraint on a type parameter.

A constraint list imposes requirements on the type argument passed to the type parameter. You can specify the following requirements in any combination:

  • The type argument must implement one or more interfaces

  • The type argument must inherit from at most one class

  • The type argument must expose a parameterless constructor that the creating code can access

  • The type argument must be a reference type, or it must be a value type

Error ID: BC32048

To correct this error

  • Verify that the expression and its elements are spelled correctly.

  • If the expression does not qualify for the preceding list of requirements, remove it from the constraint list.

  • If the expression refers to an interface or class, verify that the compiler has access to that interface or class. You might need to qualify its name, and you might need to add a reference to your project. For more information, see "References to Projects" in Resolving a Reference When Multiple Variables Have the Same Name.

Community Additions

© 2014 Microsoft