Observe the following trivial anonymous type in C#
new { X = 5 };
The respective compiler generated code as seen in Reflector (omitting the object method overrides) is:
[CompilerGenerated]
internal sealed class <>f__AnonymousType0<<X>j__TPar>
{
// Fields
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly <X>j__TPar <X>i__Field;
// Methods
[DebuggerHidden]
public <>f__AnonymousType0(<X>j__TPar X)
{
this.<X>i__Field = X;
}
// Properties
public <X>j__TPar X
{
get
{
return this.<X>i__Field;
}
}
}
My question is WOE (What On Earth) is <X>j__TPar? The type is reflected nowhere in Reflector (pun intended).
<X>j__TParis the name of the generic argument used in the<>f__AnonymousType0type definition. A bit less readable indeed thanTbut guaranteed to never collide with another name.