Created
August 4, 2009 19:34
-
-
Save mhinze/161473 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsSubclassOfOpenGeneric(this Type type, Type generic) | |
{ | |
// fine! | |
return type != typeof(object) && | |
(generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type) || | |
type.BaseType.IsSubclassOfOpenGeneric(generic)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment