Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You have declared a parameter in a lambda expression without using an As clause, with Option Strict on.
' Not valid when Option Strict is on.
' Dim increment1 = Function (n) n + 1
The previous declaration is valid if the type of n can be inferred. For example, if you are assigning the previous lambda expression to a function delegate, Del:
Delegate Function Del(ByVal p As Integer) As Integer
Now the type of n can be inferred from parameter p:
Dim increment2 as Del = Function(n) n + 1
Error ID: BC36642
To correct this error
Add an As clause to the parameter declaration:
Dim increment3 = Function (n As Integer) n + 1