Reflecting result from Linq : var « 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 = {"q", "2", 
                                  "this is a test", "aaa",
                                  "eee", "System"};

            var subset = from game in currentVideoGames 
                                 where game.Length > 6
                                 orderby game
                                 select game;

            foreach (var s in subset)
                Console.WriteLine("Item: {0}", s);

            Console.WriteLine("resultSet is of type: {0}", subset.GetType().Name);
            Console.WriteLine("resultSet location: {0}", subset.GetType().Assembly);
        
        }
    }








22.1.var
22.1.1.Using var
22.1.2.Anonymous Types
22.1.3.An Anonymous Type Assigned to a Variable Declared with the var Keyword
22.1.4.Instantiating and Initializing an Anonymous Type Using Object Initialization
22.1.5.An Example of Collection Initialization
22.1.6.Reflecting result from Linq
22.1.7.Explicit Range Variable
22.1.8.Automatic properties
22.1.9.Create struct for Collection with new syntax
22.1.10.Create and initialize the list of Simple type with new syntax
22.1.11.Filtering with OfType