1 class Program 2 { 3 static void Main(string[] args) 4 { 5 6 string[] names = { "Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" }; 7 8 9 //为扩展方法传Lambda 做参数,lambda表达式会被转化成匿名方法,匿名方法会转化成委托。注意,我们这里的扩展方法要求的参数是委托类型的实例 10 IEnumerable<string> myQuery = 11 names.Where(s => s.Length == 5) 12 .OrderBy(s => s) 13 .Select(s => s.ToLower()); 14 15 16 foreach (string item in myQuery) 17 { 18 Console.WriteLine(item); 19 } 20 21 } 22 23 }