Shared.TypeUtils.IsSubclassOfRawGeneric C# (CSharp) Method

IsSubclassOfRawGeneric() public static method

public static IsSubclassOfRawGeneric ( Type generic, Type toCheck, Type &actualGeneric ) : bool
generic System.Type
toCheck System.Type
actualGeneric System.Type
return bool
        public static bool IsSubclassOfRawGeneric(Type generic, Type toCheck, out Type actualGeneric)
        {
            while (toCheck != null && toCheck != typeof(object))
            {
                var cur = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck;
                if (generic == cur)
                {
                    actualGeneric = toCheck;
                    return true;
                }
                toCheck = toCheck.BaseType;
            }
            actualGeneric = null;
            return false;
        }