int[] a = new int[] { 2, 1, 3, 6, 8, 7 };
                      Array.Sort(a,new CompareAge());
                      foreach (int temp in a)
                      {
                          Response.Write(temp.ToString()+"<br>");
                      }
              public class CompareAge:IComparer
              {
                  int IComparer.Compare(object a,object b)
                  {
                      int i = 0,j = 0;
                      int.TryParse(a.ToString(),out i);
                      int.TryParse(b.ToString(),out j);
                      return i -j;
                  }
              }
          posted on 2009-06-15 18:23 sanmao 閱讀(90) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 咸丰县| 外汇| 靖边县| 吐鲁番市| 许昌县| 虎林市| 铜川市| 廊坊市| 宜宾县| 勐海县| 穆棱市| 始兴县| 云林县| 邵武市| 贡觉县| 东宁县| 湘潭县| 龙里县| 兴海县| 龙海市| 武平县| 辽中县| 本溪市| 介休市| 新密市| 舞阳县| 万荣县| 太和县| 兴安盟| 沂源县| 乐亭县| 灵台县| 托克逊县| 镇雄县| 荆州市| 肥乡县| 宁安市| 榕江县| 同德县| 金寨县| 彭州市|