Mega Code Archive

 
Categories / C# Tutorial / LINQ
 

Implicit Local Variables with Anonymous Types

class Program {   static void Main()   {       var patent1 =new { Title = "A",                          YearOfPublication = "1984" };       var patent2 =new { Title = "B",                          YearOfPublication = "1977" };       System.Console.WriteLine("{0} ({1})",patent1.Title, patent1.YearOfPublication);       System.Console.WriteLine("{0} ({1})",patent2.Title, patent1.YearOfPublication);   } }