How to write a VB.Net Lambda expression

vb.netLinqLambda

vb.net Problem Overview


I am working on a VB.net project now. I am new to VB.Net LINQ and would like to know the Lambda equivalent of

var _new = orders.Select(x => x.items > 0);

in VB.Net.

Someone please suggest!

vb.net Solutions


Solution 1 - vb.net

The lambda syntax isn't that much different than creating a regular delegate.

If creating a lambda which has a return value, use Function. Otherwise if you're creating one that doesn't, use Sub.

Dim _new = orders.Select(Function(x) x.Items > 0)

Dim action As Action(Of Item) = Sub(x) Console.WriteLine(x.Items)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVenugopal MView Question on Stackoverflow
Solution 1 - vb.netJeff MercadoView Answer on Stackoverflow