using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; namespace LambdaExpressionAction { class Program { static void Main(string[] args) { //定义输出委托 Action<double> print = amount => Console.WriteLine("{0:c}", amount); //定义新委托并引用上面的输出委托 Action<double> michiganSalesTax = amount => print(amount *= 1.06); //定义一个数组 var amounts = new double[] { 10.36, 12.00, 134 }; //泛型方法Array>ForEach在amounts中进行迭代并调用michiganSalesTax Array.ForEach<double>(amounts, michiganSalesTax); Console.ReadLine(); } } }