Exemplo n.º 1
0
        /// <summary>
        /// Add <paramref name="text"/> as attribute list to <paramref name="member"/>.
        /// </summary>
        /// <param name="member">The <see cref="EventDeclarationSyntax"/>.</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 EventDeclarationSyntax WithAttributeListText(this EventDeclarationSyntax 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)));
        }