.net 3.5 where 的另类用法

命名空间:  System.Linq
程序集:  System.Core(在 System.Core.dll 中)

List<string> fruits =
                new List<string> { "apple", "passionfruit", "banana", "mango",
                                "orange", "blueberry", "grape", "strawberry" };

            IEnumerable<string> query = fruits.Where(fruit => fruit.Length < 6);

            foreach (string fruit in query)
            {
                Console.WriteLine(fruit);
            }
            /*
             This code produces the following output:

             apple
             mango
             grape
            */


你可能感兴趣的:(where)