Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Comparing with null of type 'type' always produces 'false'
This warning is produced when you perform a comparison between a nullable value type variable and null, and the comparison is not ==
or !=
. To resolve this error, verify if you really want to check a value for null
. A comparison like i == null
can be either true of false. A comparison like i > null
is always false.
Example
The following sample generates CS0464.
// CS0464.cs
class MyClass
{
public static void Main()
{
int? i = 0;
if (i < null) ; // CS0464
i++;
}
}