Edit

Share via


Compiler Warning (level 2) CS0469

The 'goto case' value is not implicitly convertible to type 'type'

When you use goto case, there must be an implicit conversion from the value of the goto case to the type of the switch.

Example

The following sample generates CS0469.

C#
// CS0469.cs  
// compile with: /W:2  
class Test  
{  
   static void Main()  
   {  
      char c = (char)180;  
      switch (c)  
      {  
         case (char)127:  
            break;  
  
         case (char)180:
            goto case 127;   // CS0469  
            // try the following line instead  
            // goto case (char) 127;  
      }  
   }  
}