public static TypeDeclaration ResolveDeclaringType(this ITypeSignature typeSig, IModule context, bool throwOnFailure = false)
        {
            TypeDeclaration type             = null;
            var             declaringTypeSig = typeSig.GetDeclaringType();

            if (declaringTypeSig != null)
            {
                type = context.AssemblyManager.Resolve(declaringTypeSig, context, false) as TypeDeclaration;
            }

            if (type == null)
            {
                if (throwOnFailure)
                {
                    throw new ResolveReferenceException(string.Format(SR.TypeResolveError, typeSig.ToReflectionString()));
                }

                return(null);
            }

            return(type);
        }
        public IType Resolve(ITypeSignature typeSig, ICodeNode context, bool throwOnFailure = false)
        {
            var type = ResolveType(typeSig, context.Module, context);

            if (type == null)
            {
                if (throwOnFailure)
                {
                    throw new ResolveReferenceException(string.Format(SR.TypeResolveError, typeSig.ToReflectionString()));
                }

                return(null);
            }

            return(type);
        }