📅  最后修改于: 2020-10-31 10:27:06             🧑  作者: Mango
C#SortedList
就像SortedDictionary
SortedList
我们来看一个通用SortedList的示例
using System;
using System.Collections.Generic;
public class SortedDictionaryExample
{
public static void Main(string[] args)
{
SortedList names = new SortedList();
names.Add("1","Sonoo");
names.Add("4","Peter");
names.Add("5","James");
names.Add("3","Ratan");
names.Add("2","Irfan");
foreach (KeyValuePair kv in names)
{
Console.WriteLine(kv.Key+" "+kv.Value);
}
}
}
输出:
1 Sonoo
2 Irfan
3 Ratan
4 Peter
5 James