/// <summary> /// Add a summary element to <paramref name="comment"/> /// Replace if a summary element exists. /// </summary> /// <param name="comment">The <see cref="DocumentationCommentTriviaSyntax"/>.</param> /// <param name="text"> The text to add inside the summary element.</param> /// <returns><paramref name="comment"/> with summary.</returns> public static DocumentationCommentTriviaSyntax WithSummaryText(this DocumentationCommentTriviaSyntax comment, string text) { if (comment is null) { throw new ArgumentNullException(nameof(comment)); } if (text is null) { throw new ArgumentNullException(nameof(text)); } return(comment.WithSummary(Parse.XmlElementSyntax(CreateElementXml(text, "summary"), comment.LeadingWhitespace()))); }