'New' constraint and 'Structure' constraint cannot be combined

A constraint list includes both the New (Visual Basic) constraint and the Structure (Visual Basic) constraint.

A constraint list on a type parameter can specify that the type argument passed to that type parameter must be a value type (with the Structure constraint) or must be a reference type (with the Class (Visual Basic) constraint). You cannot specify both constraints on the same type parameter, and you cannot specify either one more than once.

The New constraint specifies that the type argument must expose a parameterless constructor that the creating code can access. However, a structure cannot have a nonshared parameterless constructor. Therefore, the New and Structure constraints are in conflict.

Error ID: BC32103

To correct this error

  1. Decide whether you want to require a value type or a reference type for the type argument.

  2. If you want the type argument to be a value type, remove the New keyword from the constraint list.

  3. If you want the type argument to be a reference type, remove the Structure keyword from the constraint list.

See Also

Concepts

Generic Types in Visual Basic

Value Types and Reference Types