Repository: dotnet/roslyn
File: src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs (C#)

Code before:
                case SyntaxKind.EventDeclaration:
                    var ev = (EventDeclarationSyntax)member;
                    return this.EventDeclaration(
                        ev.Identifier.ValueText,
                        ev.Type,
                        Accessibility.NotApplicable,
                        DeclarationModifiers.None);

                case SyntaxKind.EventFieldDeclaration:
                    var ef = (EventFieldDeclarationSyntax)member;
                    return ef.WithModifiers(default);

                // convert field into property
                case SyntaxKind.FieldDeclaration:
                    var f = (FieldDeclarationSyntax)member;
                    GetAccessibilityAndModifiers(f.Modifiers, out acc, out modifiers, out _);

                    var type = GetType(f);
                    Contract.ThrowIfNull(type);

                    return AsInterfaceMember(
                        PropertyDeclaration(GetName(f), ClearTrivia(type), acc, modifiers, getAccessorStatements: null, setAccessorStatements: null));

                // delegate declarations are valid in interfaces without modification
                case SyntaxKind.DelegateDeclaration:
                    return member;

                default:
                    throw ExceptionUtilities.UnexpectedValue(member.Kind());
            }
        });
    }

    public override SyntaxNode EnumDeclaration(
        string name,
        Accessibility accessibility,
        DeclarationModifiers modifiers,
        IEnumerable<SyntaxNode>? members)
    {
        return EnumDeclaration(name, underlyingType: null, accessibility, modifiers, members);
    }

    internal override SyntaxNode EnumDeclaration(string name, SyntaxNode? underlyingType, Accessibility accessibility = Accessibility.NotApplicable, DeclarationModifiers modifiers = default, IEnumerable<SyntaxNode>? members = null)
    {
        return SyntaxFactory.EnumDeclaration(
            default,
            AsModifierList(accessibility, modifiers, SyntaxKind.EnumDeclaration),
            name.ToIdentifierToken(),
            underlyingType != null ? SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)underlyingType)]) : null,
            this.AsEnumMembers(members));
    }

Review comment (suggestion):
@copilot  you'll want to remove the accessibility modifiers as well if possible.  See if there's code in this type that makes that possible easily.  

Code after:
                case SyntaxKind.EventDeclaration:
                    var ev = (EventDeclarationSyntax)member;
                    return this.EventDeclaration(
                        ev.Identifier.ValueText,
                        ev.Type,
                        Accessibility.NotApplicable,
                        DeclarationModifiers.None);

                case SyntaxKind.EventFieldDeclaration:
                    var ef = (EventFieldDeclarationSyntax)member;
                    return ef.WithModifiers(default);

                // convert field into property
                case SyntaxKind.FieldDeclaration:
                    var f = (FieldDeclarationSyntax)member;
                    GetAccessibilityAndModifiers(f.Modifiers, out acc, out modifiers, out _);

                    var type = GetType(f);
                    Contract.ThrowIfNull(type);

                    return AsInterfaceMember(
                        PropertyDeclaration(GetName(f), ClearTrivia(type), acc, modifiers, getAccessorStatements: null, setAccessorStatements: null));

                default:
                    throw ExceptionUtilities.UnexpectedValue(member.Kind());
            }
        });
    }

    public override SyntaxNode EnumDeclaration(
        string name,
        Accessibility accessibility,
        DeclarationModifiers modifiers,
        IEnumerable<SyntaxNode>? members)
    {
        return EnumDeclaration(name, underlyingType: null, accessibility, modifiers, members);
    }

    internal override SyntaxNode EnumDeclaration(string name, SyntaxNode? underlyingType, Accessibility accessibility = Accessibility.NotApplicable, DeclarationModifiers modifiers = default, IEnumerable<SyntaxNode>? members = null)
    {
        return SyntaxFactory.EnumDeclaration(
            default,
            AsModifierList(accessibility, modifiers, SyntaxKind.EnumDeclaration),
            name.ToIdentifierToken(),
            underlyingType != null ? SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)underlyingType)]) : null,
            this.AsEnumMembers(members));
    }

    public override SyntaxNode EnumMember(string name, SyntaxNode? expression)
    {
        return SyntaxFactory.EnumMemberDeclaration(