views:

118

answers:

2
+2  Q: 

C# Anonymous Type

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__AnonymousType02.What is this symbol <> relates to?

+8  A: 

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.

Daniel Brückner
A: 

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.

ChrisV