public static bool IsAnonymousType(this ITypeDefOrRef type) { if (type == null) { return(false); } if (string.IsNullOrEmpty(type.Namespace) && type.HasGeneratedName() && (type.Name.String.Contains("AnonType") || type.Name.String.Contains("AnonymousType"))) { TypeDef td = type.ResolveTypeDef(); return(td != null && td.IsCompilerGenerated()); } return(false); }
public static bool IsAnonymousType(this ITypeDefOrRef type) { if (type == null) { return(false); } string name; if (type.HasGeneratedName() && string.IsNullOrEmpty(type.GetNamespaceInternal()) && ((name = type.Name).Contains("AnonType") || name.Contains("AnonymousType"))) { TypeDef td = type.ResolveTypeDef(); return(td != null && td.IsCompilerGenerated()); } return(false); }