Edit

Share via


Attributes cannot be applied to parameters of lambda expressions

You have applied an attribute to a parameter in a lambda expression definition, which is not supported. The following code causes this error.

VB
Sub LambdaAttribute()  
    ' Not valid.  
    Dim add1 = _  
    Function(<System.Runtime.InteropServices.InAttribute()> m As Integer) _  
                   m + 1  
End Sub  

Error ID: BC36634

To correct this error

  • Remove the attribute, or consider revising your code by changing the lambda expression to a regular function.

See also