컴파일러 오류 CS1660
업데이트: 2007년 11월
오류 메시지
'type'은(는) 대리자 형식이 아니므로 무명 메서드 블록을 이 형식으로 변환할 수 없습니다.
Cannot convert anonymous method block to type 'type' because it is not a delegate type
이 오류는 무명 메서드 블록을 대리자 형식이 아닌 형식에 할당하거나 대리자 형식이 아닌 형식으로 변환하려고 할 때 발생합니다.
다음 샘플에서는 CS1660 오류가 발생하는 경우를 보여 줍니다.
// CS1660.cs
delegate int MyDelegate();
class C {
static void Main()
{
int i = delegate { return 1; }; // CS1660
// Try this instead:
// MyDelegate myDelegate = delegate { return 1; };
// int i = myDelegate();
}
}