Page 101 - CSharp/C#
P. 101

Two anonymous types are considered the same if and only if their properties have the same name
        and type and appear in the same order.


         var anon = new { Foo = 1, Bar = 2 };
         var anon2 = new { Foo = 7, Bar = 1 };
         var anon3 = new { Bar = 1, Foo = 3 };
         var anon4 = new { Fa = 1, Bar = 2 };
         // anon and anon2 have the same type
         // anon and anon3 have diferent types (Bar and Foo appear in different orders)
         // anon and anon4 have different types (property names are different)



        Implicitly typed arrays


        Arrays of anonymous types may be created with implicit typing.


         var arr = new[] {
             new { Id = 0 },
             new { Id = 1 }
         };


        Read Anonymous types online: https://riptutorial.com/csharp/topic/765/anonymous-types


























































        https://riptutorial.com/                                                                               47
   96   97   98   99   100   101   102   103   104   105   106