How to Create Anonymous Type Array in C#

12 Mar 2014, 09:09 AM

Anonymous type is a cool feature of .Net framework. Following is the example of creating anonymous type array in C#.

 var array = new[] {
                       new {Id = 1, Name="User 1"},
                       new {Id = 2, Name="User 2"},
                       new {Id = 3, Name="User 3"}
                   };

Related Contents

15 May 2014, 08:07 AM
C#, LINQ, List
15 May 2014, 07:54 AM
C#, LINQ, List
29 Apr 2014, 03:07 AM
C#, Generic
About
Explains how to create Implicitly-typed Arrays in Object Initializers using C#

Date Posted 12 Mar 2014, 09:06 AM
Author Brainy Solutions
Views 1,151
;