using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _06匿名函数和lamda表达式
{
public delegate string DelProStr(string name);
class Program
{
static void Main(string[] args)
{
string[] names = { "abCcDE", "FghIJkl", "mNOpqRST", "uvWXYz" };
//ProStr(names, SToUpper);//替换SToUpper 1、匿名函数 2、Lamda表达式
//ProStr(names, delegate(string str) { return str.ToUpper(); });//匿名函数的写法
//ProStr(names, str => str.ToUpper());
List<int> list = new List<int>() { , , , , , , };
//list.RemoveAll(n => n > 3);
List<int> list2 = list.Where<int>(n => n > ).ToList();
list.Where<int>((int n) => { return n > ; });
IEnumerable<int> en = list.Where<int>(n => n > );
foreach (int item in list2)
{
Console.WriteLine(item);
}
Console.ReadKey();
}
static void ProStr(string[] names, DelProStr del)
{
for (int i = ; i < names.Length; i++)
{
names[i] = del(names[i]);
}
}
static string SToUpper(string name)
{
return name.ToUpper();
}
}
}