假设每个按钮点击计数都有 5 个整数值,那么您可以按升序对它们进行排序,如下所示:
Public Class ButtonCount
Private m_Name As String
Public Property Name() As String
Get
Return m_Name
End Get
Set
m_Name = Value
End Set
End Property
Private m_Count As Integer
Public Property Count() As Integer
Get
Return m_Count
End Get
Set
m_Count = Value
End Set
End Property
Public Sub New(name As String, count As Integer)
Name = name
Count = count
End Sub
End Class
Dim listButtonCount As New List(Of ButtonCount)()
listButtonCount.Add(New ButtonCount("A", aCount))
listButtonCount.Add(New ButtonCount("B", bCount))
listButtonCount.Add(New ButtonCount("C", cCount))
listButtonCount.Add(New ButtonCount("D", dCount))
listButtonCount.Add(New ButtonCount("E", eCount))
注意:aCount
、bCount
、cCount
和是您为点击相应按钮dCount
而跟踪eCount
的五个值。Integer
Dim sortedListButtonCount As List(Of ButtonCount) = listButtonCount.OrderBy(Function(c) c.Count).ToList()