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)
Dim Func1 As Func(Of Integer, String)
Dictionary2.Add(5, 1)
Dictionary2.Add(8, 2)
Dictionary2.Add(4, 3)
Dictionary2.Add(6, 4)
' Dictionary2.Keys.OrderBy()
' Dictionary2.values.OrderBy()
我要排序Keys键值,那怎么做呢
还有Values值排序那个如何做呢
End Sub
End Class
------解决方案--------------------
按照Key排序,取Key
Dictionary2.Keys.OrderBy(Function(x) x)
按照Key排序,取Value
Dictionary2.Keys.OrderBy(Function(x) x).Select(Function(x) Dictionary2(x))