private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            var documentNode = GetMemberDocumentNode(function, xml);

            if (documentNode == null)
            {
                return(String.Empty);
            }
            if (property.Equals(DocumentElementType.Description) && !documentNode.Parameters.ContainsKey(paramName))
            {
                return(String.Empty);
            }

            switch (property)
            {
            case DocumentElementType.Summary:
                return(documentNode.Summary);

            case DocumentElementType.Description:
                return(documentNode.Parameters[paramName]);

            case DocumentElementType.SearchTags:
                return(documentNode.SearchTags);

            case DocumentElementType.SearchTagWeights:
                return(documentNode.SearchTagWeights);

            default:
                throw new ArgumentException("property");
            }
        }
        private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            //customNodeDefinitions typedParameters don't have functionDescriptors
            if (function == null)
            {
                return string.Empty;
            }
            var assemblyName = function.Assembly;

            if (string.IsNullOrEmpty(assemblyName))
                return String.Empty;

            var fullyQualifiedName = MemberDocumentNode.MakeFullyQualifiedName
                (assemblyName, GetMemberElementName(function));

            if (!documentNodes.ContainsKey(fullyQualifiedName))
            {
                if (xml == null)
                    xml = DocumentationServices.GetForAssembly(function.Assembly, function.PathManager);
                LoadDataFromXml(xml, assemblyName);
            }

            MemberDocumentNode documentNode = null;
            if (documentNodes.ContainsKey(fullyQualifiedName))
                documentNode = documentNodes[fullyQualifiedName];
            else
            {
                var overloadedName = documentNodes.Keys.
                        Where(key => key.Contains(function.ClassName + "." + function.FunctionName)).FirstOrDefault();

                if (overloadedName == null)
                    return String.Empty;
                if (documentNodes.ContainsKey(overloadedName))
                    documentNode = documentNodes[overloadedName];
            }
            
            if (documentNode == null)
                return String.Empty;
            if (property.Equals(DocumentElementType.Description) && !documentNode.Parameters.ContainsKey(paramName))
                return String.Empty;

            switch (property)
            {
                case DocumentElementType.Summary:
                    return documentNode.Summary;

                case DocumentElementType.Description:
                    return documentNode.Parameters[paramName];

                case DocumentElementType.SearchTags:
                    return documentNode.SearchTags;

                default:
                    throw new ArgumentException("property");
            }
        }
        private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            var documentNode = GetMemberDocumentNode(function, xml);

            if (documentNode == null)
                return String.Empty;
            if (property.Equals(DocumentElementType.Description) && !documentNode.Parameters.ContainsKey(paramName))
                return String.Empty;

            switch (property)
            {
                case DocumentElementType.Summary:
                    return documentNode.Summary;

                case DocumentElementType.Description:
                    return documentNode.Parameters[paramName];

                case DocumentElementType.SearchTags:
                    return documentNode.SearchTags;

                default:
                    throw new ArgumentException("property");
            }
        }
        private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            var assemblyName = function.Assembly;

            if (string.IsNullOrEmpty(assemblyName) || (function.Type == FunctionType.GenericFunction))
            {
                return(String.Empty); // Operators, or generic global function in DS script.
            }
            var fullyQualifiedName = MemberDocumentNode.MakeFullyQualifiedName
                                         (assemblyName, GetMemberElementName(function));

            if (!documentNodes.ContainsKey(fullyQualifiedName))
            {
                if (xml == null)
                {
                    xml = DocumentationServices.GetForAssembly(function.Assembly, function.PathManager);
                }
                LoadDataFromXml(xml, assemblyName);
            }

            MemberDocumentNode documentNode = null;

            if (documentNodes.ContainsKey(fullyQualifiedName))
            {
                documentNode = documentNodes[fullyQualifiedName];
            }
            else
            {
                var overloadedName = documentNodes.Keys.
                                     Where(key => key.Contains(function.ClassName + "." + function.FunctionName)).FirstOrDefault();

                if (overloadedName == null)
                {
                    return(String.Empty);
                }
                if (documentNodes.ContainsKey(overloadedName))
                {
                    documentNode = documentNodes[overloadedName];
                }
            }

            if (documentNode == null)
            {
                return(String.Empty);
            }
            if (property.Equals(DocumentElementType.Description) && !documentNode.Parameters.ContainsKey(paramName))
            {
                return(String.Empty);
            }

            switch (property)
            {
            case DocumentElementType.Summary:
                return(documentNode.Summary);

            case DocumentElementType.Description:
                return(documentNode.Parameters[paramName]);

            case DocumentElementType.SearchTags:
                return(documentNode.SearchTags);

            default:
                throw new ArgumentException("property");
            }
        }