Share via


컴파일러 오류 CS1661

업데이트: 2007년 11월

오류 메시지

지정한 무명 메서드 블록의 매개 변수 형식이 대리자 매개 변수 형식과 일치하지 않으므로 무명 메서드 블록을 'delegate type' 대리자 형식으로 변환할 수 없습니다.
Cannot convert anonymous method block to delegate type 'delegate type' because the specified block's parameter types do not match the delegate parameter types

이 오류는 무명 메서드 정의에서 무명 메서드의 매개 변수 형식이 대리자 매개 변수 형식과 일치하지 않는 경우에 발생합니다. 매개 변수의 수, 매개 변수 형식 및 ref 또는 out 매개 변수를 확인하고 정확하게 일치하는지 검사합니다.

다음 샘플에서는 CS1661 오류가 발생하는 경우를 보여 줍니다.

// CS1661.cs

delegate void MyDelegate(int i);

class C
{
    public static void Main()
    {
        MyDelegate d = delegate(string s) { };  // CS1661
    }
}