컴파일러 오류 CS0571
'function' : 연산자나 접근자를 명시적으로 호출할 수 없습니다.
일부 연산자에는 내부 이름이 있습니다. 예를 들어, op_Increment는 ++ 연산자의 내부 이름입니다. 이런 메서드 이름을 사용하거나 명시적으로 호출하면 안 됩니다.
다음 샘플에서는 CS0571 오류가 발생하는 경우를 보여 줍니다.
// CS0571.cs
public class MyClass
{
public static MyClass operator ++ (MyClass c)
{
return null;
}
public static int prop
{
get
{
return 1;
}
set
{
}
}
public static void Main()
{
op_Increment(null); // CS0571
// use the increment operator as follows
// MyClass x = new MyClass();
// x++;
set_prop(1); // CS0571
// try the following line instead
// prop = 1;
}
}