This documentation is archived and is not being maintained.

'Is' operand of type '<typeparametername>' can be compared only to 'Nothing' because '<typeparametername>' is a type parameter with no class constraint 

A type parameter is used as an operand for the Is Operator (Visual Basic) when the type parameter is defined without either the Class (Visual Basic) keyword or a specific class name in its constraint list.

Is compares two reference types to determine whether they point to the same object instance in memory. It cannot take an operand that is not a reference type unless the other operand is Nothing (Visual Basic).

Error ID: BC32052

To correct this error

  • If you can require that the type argument supplied to this type parameter always be a reference type, add either the Class keyword or a specific class name to the constraint list for the type parameter.

  • If you cannot require that the type argument supplied to this type parameter always be a reference type, remove it from the Is expression. You cannot compare it to other reference types with the Is operator.

See Also

Show: