Ejemplo n.º 1
0
        /// <summary>
        /// Add a typeparam element to <paramref name="comment"/>
        /// Replace if a summary element exists.
        /// If the comment is attached to a method the param element is inserted at the correct position.
        /// </summary>
        /// <param name="comment">The <see cref="DocumentationCommentTriviaSyntax"/>.</param>
        /// <param name="parameterName">The name of the parameter.</param>
        /// <param name="text"> The text to add inside the summary element.</param>
        /// <returns><paramref name="comment"/> with summary.</returns>
        public static DocumentationCommentTriviaSyntax WithTypeParamText(this DocumentationCommentTriviaSyntax comment, string parameterName, string text)
        {
            if (comment is null)
            {
                throw new ArgumentNullException(nameof(comment));
            }

            if (parameterName is null)
            {
                throw new ArgumentNullException(nameof(parameterName));
            }

            if (text is null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            return(comment.WithTypeParam(Parse.XmlElementSyntax(CreateElementXml(text, "typeparam", parameterName), comment.LeadingWhitespace())));
        }