June 23, 2011

Code Example for Anonymous type and Type Inference in C#


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


namespace ConsoleApplication7
{
   class Program
    {
        static void Main(string[] args)
        {
            var P = new { firstname = "ABC" };//P object of anonymost class 
            Console.WriteLine(P.firstname);
        }
    }
}

No comments:

Post a Comment