Linq Over Array Using Sequence : foreach loop « LINQ « C# / CSharp Tutorial






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

    class Program
    {
        static void Main(string[] args)
        {
            string[] currentVideoGames = {"test", "this is a test", "asdf", "game 1","game 2", "game 3"};
            var subset = from g in currentVideoGames where g.Length > 6 orderby g select g;
            foreach (var s in subset)
                Console.WriteLine("Item: {0}", s);
        }
    }








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