VB.NET Lambda表达式的示例 [英] Examples of VB.NET lambda expression

查看:328
本文介绍了VB.NET Lambda表达式的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以找到使用VB.NET Lambda Expression语法制作的复杂LINQ示例?

Where can I find complex LINQ examples made using VB.NET Lambda Expression syntax?

在搜索过程中,我总是找到 101个LINQ示例,但它们使用了其他符号,对我而言,并不总是很清楚如何将代码转换为lambda表达式.

During my searches I always found 101 LINQ Samples but they use the other notation and for me is not always clear how to transform that code into a lambda expression.

推荐答案

您只需查看

You could just look at MSDN. They have at least one example for each of the IEnumerable-extensions in C# and also in VB.Net.

一些随机示例:

' Select
Dim squares As IEnumerable(Of Integer) = _
        Enumerable.Range(1, 10).Select(Function(x) x * x)

' Aggregate
Dim reversed As String = _
        words.Aggregate(Function(ByVal current, ByVal word) word & " " & current)

' Max
Dim max As Integer = pets.Max(Function(pet) _
                                      pet.Age + pet.Name.Length)

 ' SkipWhile
Dim query As IEnumerable(Of Integer) = _
        amounts.SkipWhile(Function(amount, index) _
                              amount > index * 1000)

这篇关于VB.NET Lambda表达式的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆