다음을 통해 공유


'<methodname>' 메서드에 '<delegatename>' 대리자와 호환되는 시그니처가 없습니다.

업데이트: 2007년 11월

Method '<methodname>' does not have a signature compatible with delegate <'delegatename'>

이 오류는 메서드와 대리자 간에 변환이 필요한데 변환할 수 없는 경우 발생합니다. 이 오류의 원인은 매개 변수 간 변환에 있거나, 메서드와 대리자가 함수인 경우 반환 값의 변환에 있습니다.

다음 코드에서는 실패한 변환을 보여 줍니다. 대리자는 FunDel입니다.

Delegate Function FunDel(ByVal i As Integer, ByVal d As Double) As Integer

다음의 각 함수는 이 오류를 발생시키는 방식이 FunDel과 다릅니다.

Function ExampleMethod1(ByVal m As Integer, ByVal aDate As Date) As Integer
End Function

Function ExampleMethod2(ByVal m As Integer, ByVal aDouble As Double) As Date
End Function

다음의 각 할당문은 이 오류를 발생시킵니다.

Sub Main()
    ' The second parameters of FunDel and ExampleMethod1, Double and Date,
    ' are not compatible.
    'Dim d1 As FunDel = AddressOf ExampleMethod1

    ' The return types of FunDel and ExampleMethod2, Integer and Date,
    ' are not compatible.
    'Dim d2 As FunDel = AddressOf ExampleMethod2

End Sub

오류 ID: BC31143

이 오류를 해결하려면

  • 대응하는 매개 변수와 반환 형식(있는 경우)을 검토하여 호환되지 않는 쌍을 확인합니다.

참고 항목

개념

완화된 대리자 변환

대리자 및 AddressOf 연산자