コード例 #1
0
        public static EventFieldDeclarationSyntax AddStaticModifier(EventFieldDeclarationSyntax eventFieldDeclaration)
        {
            if (eventFieldDeclaration == null)
            {
                throw new ArgumentNullException(nameof(eventFieldDeclaration));
            }

            SyntaxTokenList modifiers = eventFieldDeclaration.Modifiers;

            if (!modifiers.Contains(SyntaxKind.StaticKeyword))
            {
                return(eventFieldDeclaration.InsertModifier(SyntaxKind.StaticKeyword, ModifierComparer.Instance));
            }
            else
            {
                return(eventFieldDeclaration);
            }
        }