May 2010
Intermediate to advanced
1272 pages
61h 18m
English
As their name implies, anonymous types are .NET objects that have no name and can be generated on-the-fly. They were first introduced with .NET Framework 3.5, and their main purpose is collecting data from LINQ queries. Generally you prefer named types to anonymous types outside particular LINQ scenarios; however, it’s important to understand how anonymous types work. Declaring an anonymous type is straightforward, as shown in the following code snippet:

As you can see, no name for the new type is specified, and a new instance is created just invoking the New With statement. Creating an anonymous type takes advantage of two ...
Read now
Unlock full access