集合之sortlist

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
SortedList sl
= new SortedList();

sl[
"c"] = 41;
sl[
"b"] = 23;
sl[
"a"] = 12;
sl[
"d"] = 32;

foreach (DictionaryEntry de in sl)
{
string str = (string)de.Key;
int i = (int)de.Value;
Console.WriteLine(
"{0}:{1}",str,i);
}
}
}
}

//a:12
//b:23
//c:41
//d:32
//请按任意键继续. . .

posted on 2011-09-14 22:55  别人叫我军师  阅读(192)  评论(0编辑  收藏  举报