Linq To Objects : foreach loop « LINQ « C# / CSharp Tutorial






using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;

    class LinqToObjects
    {
        static void Main(string[] args)
        {
            string[] names = { "test", "test 1", "Am" };
            IEnumerable<string> namesOfPeople = from name in names where name.Length <= 2 select name;
            foreach (var name in namesOfPeople)
                Console.WriteLine(name);
             
        }

    }








22.14.foreach loop
22.14.1.Use foreach loop to deal with the result from linq
22.14.2.Linq Over Array Using Sequence
22.14.3.Linq Over ArrayList
22.14.4.Linq To Objects
22.14.5.Linq over array
22.14.6.Cars going faster than 55, ordered by PetName
22.14.7.Simple linq