使用了匿名方法升级版本
//int[] ary = { 12, 5, 23, 8, 34, 22, 67, 10, 14, 56, 37 };
//var result = ary.Where(delegate(int x)
// {
// return x % 2 == 0;
// }
// )
// .OrderByDescending(delegate(int x)
// {
// return x;
// }
// )
// .Select(delegate(int x)
// {
// return x;
// });
//foreach (var x in result)
//{
// Console.WriteLine(x);
//}
使用了匿名方法
//int[] ary = { 12, 5, 23, 8, 34, 22, 67, 10, 14, 56, 37 };
//var result = ary.Where(delegate(int x)
//{
// if (x % 2 == 0)
// {
// return true;
// }
// else
// {
// return false;
// }
//}
// )
// .OrderByDescending(delegate(int x)
// {
// return x;
// }
// )
// .Select(delegate(int x)
// {
// return x;
// });
//foreach (var x in result)
//{
// Console.WriteLine(x);
//}
使用了匿名委托对象
//int[] ary = { 12, 5, 23, 8, 34, 22, 67, 100, 14, 56, 37 };
//var result = ary.Where(new Func<int, bool>(WhereFunction))
// .OrderByDescending(new Func<int, int>(OrderByDescFunction))
// .Select(new Func<int, int>(SelectFunction));
//foreach (var x in result)
//{
// Console.WriteLine(x);
//}
使用了具名委托对象
//int[] ary = { 12, 5, 23, 8, 34, 22, 67, 10, 14, 56, 37 };
//Func<int, bool> funcWhere = new Func<int, bool>(WhereFunction);
//Func<int,int> funcOrderBy=new Func<int,int>(OrderByDescFunction);
//Func<int,int> funcSelect=new Func<int,int>(SelectFunction);
//var result = ary.Where(funcWhere).OrderByDescending(funcOrderBy).Select(funcSelect);
//foreach (var x in result)
//{
// Console.WriteLine(x);
//}
//int[] ary = {12,5,23,8,34,22,67,100,14,56,37 };
//List<int> result = new List<int>();
//foreach (var x in ary)
//{
// if (x%2==0)
// {
// result.Add(x);
// }
//}
//result.Sort();
//result.Reverse();
//for (int i = 0; i < result.Count-1; i++)
//{
// for (int j = 0; j < result.Count-i-1; j++)
// {
// if (result[j]<result[j+1])
// {
// int temp = result[j];
// result[j] = result[j + 1];
// result[j + 1] = temp;
// }
// }
//}
//foreach (var x in result)
//{
// Console.WriteLine(x);
//}