static bool CheckEquivalent(DmdType td) { Debug.Assert((object)td != null); for (int i = 0; (object)td != null && i < 1000; i++) { if (i != 0) { var info = GetInfo(td); if (info == null) { return(false); } } bool f; if (td.IsInterface) { f = td.IsImport || td.IsDefined("System.Runtime.InteropServices.ComEventInterfaceAttribute", inherit: false); } else { f = td.IsValueType || IsDelegate(td); } if (!f) { return(false); } if (td.IsGenericTypeDefinition) { return(false); } var declType = td.DeclaringType; if ((object)declType == null) { return(td.IsPublic); } if (!td.IsNestedPublic) { return(false); } td = declType; } return(false); }