I have these objects
Public Class Class1
Public Property Type As String
Public Property SpecLimits As Limits
End Class
Public Class Limits
Public Property MinValue As Double?
Public Property MaxValue As Double?
End Class
I can have more Type
-s with their Speclimits
values. I need to find the maximum of MaxValue. I can make it with a for each
to check every time which number is bigger, but I thought maybe their is some linq
with what this could be achievable.
I found something like this in c#
var maxItem = emplist
.Select((emp, index) => new
{
maxProject = emp.project
.Select((proj, pIndex) => new{ proj, pIndex })
.OrderByDescending(x => x.proj.ID)
.First(),
emp, index
})
.OrderByDescending(x => x.maxProject.proj.ID)
.First();
but I can't translate it to vb.net
Any help is appreciated!
CodePudding user response:
I guess you want something like this:
Dim minValue As Double = list.Min(Function(x) x.SpecLimits.MinValue)
Dim maxValue As Double = list.Max(Function(x) x.SpecLimits.MaxValue)