共用方式為


編譯器錯誤 CS0216

更新:2007 年 11 月

錯誤訊息

運算子 'operator' 要求相對應的運算子 'missing_operator' 也要被定義

使用者定義的 true 運算子需要使用者定義的 false 運算子,反之亦然。如需詳細資訊,請參閱運算子 (C# 程式設計手冊)

下列範例會產生 CS0216:

// CS0216.cs
class MyClass
{
   public static bool operator true (MyClass MyInt)   // CS0216
   {
      return true;
   }

   // to resolve, uncomment the following operator definition
   /*
   public static bool operator false (MyClass MyInt)
   {
      return true;
   }
   */

   public static void Main()
   {
   }
}