2 // Tests anonymous type consolidation
5 using System
.Collections
;
16 var v1
= new { Name = "Scott", Age = 21 }
;
17 var v2
= new { Age = 20, Name = "Sam" }
;
18 var v3
= new { Name = Null (), Age = 33 }
;
20 if (v1
.GetType () == v2
.GetType ())
26 if (v1
.GetType () != v3
.GetType ())
32 if (v1
.GetHashCode () != v1
.GetHashCode ())
35 Console
.WriteLine (v1
);
36 Console
.WriteLine (v3
);
38 if (v1
.ToString () != "{ Name = Scott, Age = 21 }")
41 if (v3
.ToString () != "{ Name = , Age = 33 }")
46 if (v4
.ToString () != "{ }")
49 var v5
= new { Foo = "Bar" }
;
50 var v6
= new { Foo = Null () }
;
52 if (v5
.ToString () != "{ Foo = Bar }")
55 if (v6
.ToString () != "{ Foo = }")