Hi,
you can user order by descending and take the first item like in following demo:
Module Module62
Sub Main()
Try
Call (New Demo).Execute()
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
Console.WriteLine("Continue enter key")
Console.ReadKey()
End Sub
Friend Class Demo
Friend Sub Execute()
Dim itemList As New List(Of Data)
itemList.Add(New Data With {.Name = $"BOX", .PKeyList = 1})
itemList.Add(New Data With {.Name = $"BOX", .PKeyList = 3})
itemList.Add(New Data With {.Name = $"BOX", .PKeyList = 2})
Dim maxAmount = (From item In itemList
Where item.Name = "BOX"
Order By item.PKeyList Descending).First.PKeyList
Console.WriteLine(maxAmount)
End Sub
End Class
Friend Class Data
Friend Property Name As String
Friend Property PKeyList As Integer
End Class
End Module