Events
Mar 17, 11 PM - Mar 21, 11 PM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
The following sample generates CS0464.
// CS0464.cs
class MyClass
{
public static void Main()
{
int? i = 0;
if (i < null) ; // CS0464
i++;
}
}
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 11 PM - Mar 21, 11 PM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register now