linq本质扩展方法+lambda表达式

 string[] names = { "aa","bb","cc","dd"};
            /*
            IEnumerable<string> query = from s in names
                                        where s.Length == 2
                                        orderby s
                                        select s.ToUpper();
            */
            IEnumerable<string> query1 = names.Where(s => s.Length == 2)
                .OrderBy(s => s)
                .Select(s => s.ToUpper());

            foreach (string s in query1)
            {
                Response.Write(s+"</br>");
            }

 

你可能感兴趣的:(lambda)