Catel.Fody.CecilCatelExtensions.ImplementsBaseType C# (CSharp) Method

ImplementsBaseType() public static method

public static ImplementsBaseType ( this typeReference, string typeName ) : bool
typeReference this
typeName string
return bool
        public static bool ImplementsBaseType(this TypeReference typeReference, string typeName)
        {
            if (typeReference == null)
            {
                return false;
            }

            string requestKey = $"{typeReference.FullName}_{typeName}";
            bool implementsModelBase;
            if (_implementsTypeCache.TryGetValue(requestKey, out implementsModelBase))
            {
                return implementsModelBase;
            }

            TypeDefinition typeDefinition;
            if (typeReference.IsDefinition)
            {
                typeDefinition = (TypeDefinition)typeReference;
            }
            else
            {
                typeDefinition = typeReference.ResolveType();
            }

            if (DerivesFromType(typeDefinition, typeName))
            {
                _implementsTypeCache[requestKey] = true;
                return true;
            }

            var result =  ImplementsBaseType(typeDefinition.BaseType, typeName);
            _implementsTypeCache[requestKey] = result;
            return result;
        }