There is no C# language construct which allows you to say "Is this an anonymous type". You can use a simple heuristic to approximate if a type is an anonymous type, but it's possible to get tricked by people hand coding IL, or using a language where such characters as > and < are valid in identifiers.
public static class TypeExtensions {
public static bool IsAnonymousType(this Type t) {
var name = t.Name;
if ( name.Length < 3 ) {
return false;
}
return name[0] == '<'
&& name[1] == '>'
&& name.IndexOf("AnonymousType", StringComparison.Ordinal) > 0;
}