排序

 class Program
    {     
        static void Main(string[] args)
        {
 
            int[] ints = new int[] { 1, 3, 5, 7, 9, 2, 4, 6, 8, 10 };

            int k = ints.First(delegate(int o){ return o == 3; });

            int kk1 = ints.Count(delegate(int o) { return o > 3; });
           
            
            //int[] kk

            run();

            
        }

        private static void run()
        {
            //Sort(ints, Asc);
            //Sort(ints, delegate(int a, int b) { return a > b; });
        }

        public delegate bool ComparableHandle(int first, int second);

        static void Sort(int[] aInts, ComparableHandle compara)
        {
            for (int i = 0; i < aInts.Length; i++)
                for (int j = i + 1; j < aInts.Length; j++)
                {
                    if (compara(aInts[i], aInts[j]))   
                    {                        
                        int temp = aInts[i];
                        aInts[i] = aInts[j];
                        aInts[j] = temp;
                    }                  
                }
        }

        public static bool Asc(int first, int second)
        {
            return first > second;
        }


        public static bool Desc(int first, int second)
        {
            return first < second;
        }

        
    }

posted @ 2012-04-01 19:56  rayray2  阅读(134)  评论(0编辑  收藏  举报