/// <summary> /// Returns whether or not <paramref name="typeRef"/> and <paramref name="type"/> /// are equal. /// </summary> /// <param name="acceptDerivedTypes"> /// If <code>true</code>, this method will be called recursively on <code>typeRef.BaseType</code>. /// </param> public static bool Is(this TypeReference typeRef, Type type, bool acceptDerivedTypes = true) { TypeDefinition def; return(typeRef.FullName == type.FullName || (acceptDerivedTypes && (def = typeRef.AsTypeDefinition())?.BaseType != null && def.BaseType.Is(type, acceptDerivedTypes))); }