Examples of VB.NET lambda expression
Where can I find complex LINQ examples made using VB.NET Lambda Expression syntax?
During my searches I a开发者_如何学Golways 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.
Some random examples:
' 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)
精彩评论