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 閱讀(87) 評論(0)  編輯  收藏

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


          網站導航:
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 沾益县| 万荣县| 闵行区| 丽江市| 佛坪县| 乡宁县| 西宁市| 当雄县| 潞城市| 福海县| 柳州市| 南涧| 象州县| 安溪县| 安顺市| 固阳县| 江山市| 山西省| 淅川县| 泸州市| 米林县| 剑阁县| 德昌县| 页游| 富锦市| 深圳市| 永仁县| 富阳市| 杭州市| 保山市| 金山区| 军事| 夏河县| 华亭县| 县级市| 南江县| 鄂尔多斯市| 屏南县| 鹿泉市| 阜新市| 安龙县|