Aracılığıyla paylaş


'Structure' constraint and a specific class type constraint cannot be combined

A constraint list includes both the Structure (Visual Basic) constraint and the name of a defined class.

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 (include the New constraint)

If you do not include any specific class or interface in the constraint list, you can impose a more general requirement by specifying one of the following:

  • The type argument must be a value type (include the Structure constraint)

  • The type argument must be a reference type (include the Class constraint)

You cannot specify both Structure and Class for the same type parameter, and you cannot specify either one more than once.

Error ID: BC32108

To correct this error

  • If you want the type argument to be a value type, remove the class name from the constraint list.

  • If you want the type argument to inherit from the specified class name, remove the Structure keyword from the constraint list.

See Also

Concepts

Generic Types in Visual Basic

Value Types and Reference Types