Browse by Tags

Tagged Content List
  • Blog Post: Anonymous Types Unify Within An Assembly, Part Two

    Last time I noted that any two usages of "the same" anonymous type within an assembly actually unify to be the same type. By "the same" we mean that the two anonymous types have the same property names and types, and that they appear in the same order. new {X = 1, Y = 2 } and new { Y = 2, X = 1 } do...
  • Blog Post: Anonymous types unify within an assembly, Part One

    Back in my last post of 2010 I said that I would do an example of anonymous types unifying within an assembly "in the new year". I meant 2011, but here we are "in the new year" again, so, no time like the present. The C# specification guarantees you that when you use "the same" anonymous type in two...
  • Blog Post: Why are anonymous types generic?

    Suppose you use an anonymous type in C#: var x = new { A = "hello", B = 123.456 }; Ever taken a look at what code is generated for that thing? If you crack open the assembly with ILDASM or some other tool, you'll see this mess in the top-level type definitions .class '<>f__AnonymousType0`2'<...
Page 1 of 1 (3 items)