Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 2) CS0464 

Error Message

Comparing with null of type 'type' always produces 'false'

This warning is produced when you perform a comparison between a nullable 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++;
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft