Mono.Cecil.GenericParameterResolver.ContainsGenericParameters C# (CSharp) Method

ContainsGenericParameters() private static method

private static ContainsGenericParameters ( TypeReference typeReference ) : bool
typeReference TypeReference
return bool
        private static bool ContainsGenericParameters(TypeReference typeReference)
        {
            var genericParameter = typeReference as GenericParameter;
            if (genericParameter != null)
                return true;

            var arrayType = typeReference as ArrayType;
            if (arrayType != null)
                return ContainsGenericParameters (arrayType.ElementType);

            var pointerType = typeReference as PointerType;
            if (pointerType != null)
                return ContainsGenericParameters (pointerType.ElementType);

            var byRefType = typeReference as ByReferenceType;
            if (byRefType != null)
                return ContainsGenericParameters (byRefType.ElementType);

            var sentinelType = typeReference as SentinelType;
            if (sentinelType != null)
                return ContainsGenericParameters (sentinelType.ElementType);

            var pinnedType = typeReference as PinnedType;
            if (pinnedType != null)
                return ContainsGenericParameters (pinnedType.ElementType);

            var requiredModifierType = typeReference as RequiredModifierType;
            if (requiredModifierType != null)
                return ContainsGenericParameters (requiredModifierType.ElementType);

            var genericInstance = typeReference as GenericInstanceType;
            if (genericInstance != null) {
                foreach (var genericArgument in genericInstance.GenericArguments) {
                    if (ContainsGenericParameters (genericArgument))
                        return true;
                }

                return false;
            }

            if (typeReference is TypeSpecification)
                throw new NotSupportedException ();

            return false;
        }