Share via


컴파일러 오류 CS0215

업데이트: 2007년 11월

오류 메시지

True 또는 False 연산자의 반환 형식은 bool이어야 합니다.
The return type of operator True or False must be bool

사용자 정의 TrueFalse 연산자의 반환 형식은 bool이어야 합니다. 자세한 내용은 오버로드할 수 있는 연산자(C# 프로그래밍 가이드)를 참조하십시오.

다음 샘플에서는 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()
   {
   }
}