Reputation: 111
When I say Anonymous Type Declaration
var someType = new { Name = "Jon Skeet", Age = 10 };
However the Keyword
var is implicitly typed
but when i print
Response.Write(someType.GetType().Name);
it produces <>f__AnonymousType0
2.
What is this symbol <>
relates to?
Upvotes: 3
Views: 898
Reputation: 3423
It's part of the type name. It doesn't mean anything specific, but uses a sequence of characters that is unlikely to conflict with any human-written code.
Upvotes: 1
Reputation: 59635
The compiler generates a regular class for your anonymous type and chooses a name that is valid in IL but not in C# to prevent name conflicts with your type names.
Upvotes: 12