public bool Equals(NativeFormatMethodCommon other) { if (!(_reader == other._reader)) return false; if (!(_methodHandle.Equals(other._methodHandle))) return false; if (!(_contextTypeInfo.Equals(other._contextTypeInfo))) return false; return true; }
// // This is a port of the desktop CLR's RuntimeType.FormatTypeName() routine. This routine is used by various Reflection ToString() methods // to display the name of a type. Do not use for any other purpose as it inherits some pretty quirky desktop behavior. // // The Project N version takes a raw metadata handle rather than a completed type so that it remains robust in the face of missing metadata. // public static String FormatTypeName(this RuntimeTypeInfo runtimeType) { try { // Though we wrap this in a try-catch as a failsafe, this code must still strive to avoid triggering MissingMetadata exceptions // (non-error exceptions are very annoying when debugging.) // Legacy: this doesn't make sense, why use only Name for nested types but otherwise // ToString() which contains namespace. RuntimeTypeInfo rootElementType = runtimeType; while (rootElementType.HasElementType) { rootElementType = rootElementType.InternalRuntimeElementType; } if (rootElementType.IsNested) { String name = runtimeType.InternalNameIfAvailable; return(name == null ? UnavailableType : name); } // Legacy: why removing "System"? Is it just because C# has keywords for these types? // If so why don't we change it to lower case to match the C# keyword casing? FoundationTypes foundationTypes = ReflectionCoreExecution.ExecutionDomain.FoundationTypes; String typeName = runtimeType.ToString(); if (typeName.StartsWith("System.")) { foreach (Type pt in ReflectionCoreExecution.ExecutionDomain.PrimitiveTypes) { if (pt.Equals(rootElementType) || rootElementType.Equals(foundationTypes.SystemVoid)) { typeName = typeName.Substring("System.".Length); break; } } } return(typeName); } catch (Exception) { return(UnavailableType); } }
public sealed override IEnumerable <Type> CoreGetDeclaredMembers(RuntimeTypeInfo type, NameFilter optionalNameFilter, RuntimeTypeInfo reflectedType) { Debug.Assert(reflectedType.Equals(type)); // NestedType queries are always performed as if BindingFlags.DeclaredOnly are set so the reflectedType should always be the declaring type. return(type.CoreGetDeclaredNestedTypes(optionalNameFilter)); }