public static HashSet <ResourceType> GetDerivedTypes(this ResourceType resourceType) { ResourceCustomState customState = resourceType.CustomState as ResourceCustomState; if (customState == null) { return(new HashSet <ResourceType>()); } else { return(customState.DerivedTypes); } }
public static bool DoesClrTypeMatch(this ResourceType resourceType, Type clrType) { ResourceCustomState customState = resourceType.CustomState as ResourceCustomState; if (customState != null) { if (string.Equals(customState.ClrTypeString, clrType.AssemblyQualifiedName) || string.Equals(customState.ClrTypeString, clrType.FullName)) { return(true); } else { return(false); } } else { return(false); } }
public static ResourceType FindResourceType(this ResourceType resourceType, Type clrType) { ResourceType resourceType1; if (!resourceType.DoesClrTypeMatch(clrType)) { ResourceCustomState customState = resourceType.CustomState as ResourceCustomState; if (customState != null) { HashSet <ResourceType> .Enumerator enumerator = customState.DerivedTypes.GetEnumerator(); try { while (enumerator.MoveNext()) { ResourceType current = enumerator.Current; if (!current.DoesClrTypeMatch(clrType)) { continue; } resourceType1 = current; return(resourceType1); } return(resourceType); } finally { enumerator.Dispose(); } return(resourceType1); } else { return(resourceType); } } else { return(resourceType); } }