Baca dalam bahasa Inggris

Bagikan melalui


Compiler Error CS0215

Jenis pengembalian operator True atau False harus berupa bool

Operator true dan false yang ditentukan pengguna harus memiliki jenis pengembalian berupa bool.

Sampel berikut menghasilkan CS0215:

// CS0215.cs  
class MyClass  
{  
   public static int operator true (MyClass MyInt)   // CS0215  
   // try the following line instead  
   // public static bool operator true (MyClass MyInt)  
   {  
      return true;  
   }  
  
   public static int operator false (MyClass MyInt)   // CS0215  
   // try the following line instead  
   // public static bool operator false (MyClass MyInt)  
   {  
      return true;  
   }  
  
   public static void Main()  
   {  
   }  
}