Nested function does not have a signature that is compatible with delegate '<delegatename>'

A lambda expression has been assigned to a delegate that has an incompatible signature. For example, in the following code, delegate Del has two integer parameters.

Delegate Function Del(ByVal p As Integer, ByVal q As Integer) As Integer  

The error is raised if a lambda expression with one argument is declared as type Del:

' Neither of these is valid.   
' Dim lambda1 As Del = Function(n As Integer) n + 1  
' Dim lambda2 As Del = Function(n) n + 1  

Error ID: BC36532

To correct this error

  • Adjust either the delegate definition or the assigned lambda expression so that the signatures are compatible.

See Also

Relaxed Delegate Conversion
Lambda Expressions