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

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


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

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 雅安市| 黄大仙区| 巴彦淖尔市| 泰和县| 乌审旗| 枣强县| 商水县| 汶川县| 高淳县| 旬邑县| 阳泉市| 南漳县| 新龙县| 麻江县| 平陆县| 阜新市| 酉阳| 琼中| 台湾省| 加查县| 色达县| 古丈县| 图木舒克市| 亚东县| 河源市| 松滋市| 宝应县| 香河县| 台南县| 日照市| 商都县| 衡阳县| 巴彦淖尔市| 乃东县| 许昌市| 夹江县| 喀什市| 夏津县| 阳东县| 堆龙德庆县| 肥乡县|