Welcome to MSDN Blogs Sign in | Join | Help

Wriju's BLOG

.NET and everything
VB.NET 10 : Multiline Lambdas

With implicit line continuation VB.NET 10 now allows you to write the multiline Lambdas. That means like your normal Functions you can write functions under Lambdas.

So now you may write like,

Dim arrInt As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

 

Dim myFinc = Array.FindAll(arrInt, Function(n)

                                       If n Mod 2 = 0 Then

                                           Console.WriteLine("{0} is Even", n)

                                       Else

                                           Console.WriteLine("{0} is not Even", n)

                                       End If

                                   End Function)

 

Namoskar!!!

Posted: Sunday, November 08, 2009 6:36 AM by wriju

Comments

iCe said:

Does it support "non-function lambdas", that is, lambdas that do not return a value?

# November 8, 2009 2:53 PM

FileUpload said:

Nice post, it is really helpful. which version onwards it is supported .

# November 11, 2009 1:42 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker