Tech
Decompiling anonymous types: the generated generic class behind new { a, b }
Type a new { } in C# and you create an object with no type you can name. var row = new { Name = customer.Name, Total = customer.Total }; gives you a row you can read .Name and .Total off, pass to LINQ, and compare for equality β but try to write its type and you cannot, because there is no keyword for it. That absence is a source-language illusion, exactly like ?. having no IL opcode. In the compiled assembly the anonymous type is a perfectly ordinary class. The compiler just synthes...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to