Is it possible to create anonymous delegates in vb.net version 8 or earlier? If so, could someone provide an example of the syntax? Thanks.
From stackoverflow
-
In VB 9.0 you can create single line lambda expressions
Dim del = Function (x) x + 42
In VB 10.0 (not yet released). You will be able to create both multiline function and sub routines (as well as single line subs). For example
Dim del = Function (x) Return x + 42 End Funtion
EDIT OP clarified it was for pre- VB 9.0
No, there is no way prior to VB 9.0 to create lambda expressions / anonymous delegates in VB.
Meta-Knight : Although it didn't answer the question, thanks for the info about VB10 anonymous delegates! -
Yes, but only in Visual Studio 2008/.Net 3.0 and later.
Use the Function keyword.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.