Example #1
0
        /// <summary>
        /// Add <paramref name="text"/> as attribute list to <paramref name="member"/>.
        /// </summary>
        /// <param name="member">The <see cref="DelegateDeclarationSyntax"/>.</param>
        /// <param name="text">
        /// The attribute text including start and end [].
        /// </param>
        /// <param name="adjustLeadingWhitespace">If true leading whitespace is adjusted to match <paramref name="member"/>.</param>
        /// <returns>The <paramref name="member"/> with docs in leading trivia.</returns>
        public static DelegateDeclarationSyntax WithAttributeListText(this DelegateDeclarationSyntax member, string text, bool adjustLeadingWhitespace = true)
        {
            if (member is null)
            {
                throw new System.ArgumentNullException(nameof(member));
            }

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

            return(member.WithAttributeList(Parse.AttributeList(text, adjustLeadingWhitespace ? member.LeadingWhitespace() : null)));
        }