标签:write bsp span nbsp line color 案例 var console
//案例:把分拣奇偶数的程序用泛型实现。int[] nums={1,2,3,4,5,6,7,8,9};奇数在左边 偶数在右边 int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; List<int> listJi = new List<int>(); List<int> listOu = new List<int>(); for (int i = 0; i < nums.Length; i++) { if (nums[i] % 2 == 0) { listOu.Add(nums[i]); } else { listJi.Add(nums[i]); } } listJi.AddRange(listOu); foreach (var item in listJi) { Console.WriteLine(item); } Console.ReadKey();
案例:把分拣奇偶数的程序用泛型实现。int[] nums={1,2,3,4,5,6,7,8,9};奇数在左边 偶数在右边
标签:write bsp span nbsp line color 案例 var console
原文地址:http://www.cnblogs.com/blacop/p/5989050.html