Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim Dictionary2 As New Dictionary(Of Integer, String)
Dictionary2.Add(5, 1)
Dictionary2.Add(8, 2)
Dictionary2.Add(4, 3)
Dictionary2.Add(6, 4)
' 按照Key排序, 取Key
Dictionary2.Keys.OrderBy(Function(x) x)
'
升序排序结果应该是键值4568的。 怎么结果还是原来的5846呢
End Sub
End Class
------解决方案--------------------
Dictionary2.Keys.OrderBy,不会改变原有字典的排序,只是返回一个新的排序后的列表