'Is' operand of type 'typename' can only be compared to 'Nothing', because 'typename' is a nullable type
A variable declared as nullable has been compared to an expression other than Nothing
by using the Is
operator.
Error ID: BC32127
- To compare a nullable value type to an expression other than
Nothing
by using theIs
operator, call theGetType
method on the nullable value type and compare the result to the expression, as shown in the following example.
VB
Dim number? As Integer = 5
If number IsNot Nothing Then
If number.GetType() Is Type.GetType("System.Int32") Then
End If
End If
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: