Compiler Warning (level 1) CS0183

The given expression is always of the provided ('type') type

If a conditional statement always evaluates to true, then you do not need a conditional statement. This warning occurs when you try to evaluate a type using the is operator. If the evaluation is a value type, then the check is unnecessary.

The following sample generates CS0183:

// CS0183.cs  
// compile with: /W:1  
using System;  
public class Test  
{  
   public static void F(Int32 i32, String str)  
   {  
      if (str is Object)          // OK  
         Console.WriteLine( "str is an object" );  
      else  
         Console.WriteLine( "str is not an object" );  

      if (i32 is Object)   // CS0183  
         Console.WriteLine( "i32 is an object" );  
      else  
         Console.WriteLine( "i32 is not an object" ); // never reached  
   }  

   public static void Main()  
   {  

      F(0, "CS0183");  
      F(120, null);   
   }  
}