'TryCast' operand must be reference type, but '<typename>' is a value type
The TryCast operator is used with a value type for at least one of the arguments.
TryCast tests for an inheritance or implementation relationship between the two arguments. Therefore, it allows only reference types for the arguments. For more information, see Value Types and Reference Types.
Error ID: BC30792
To correct this error
- Use DirectCast or CType to perform the conversion. They both allow value types.
See Also
Concepts
Value Types and Reference Types