Пример #1
0
        private static IEnumerable <EventFieldDeclarationSyntax> SplitEventFieldDeclaration(EventFieldDeclarationSyntax fieldDeclaration)
        {
            SeparatedSyntaxList <VariableDeclaratorSyntax> variables = fieldDeclaration.Declaration.Variables;

            EventFieldDeclarationSyntax fieldDeclaration2 = fieldDeclaration.WithoutTrivia();

            for (int i = 0; i < variables.Count; i++)
            {
                EventFieldDeclarationSyntax newDeclaration = EventFieldDeclaration(
                    fieldDeclaration2.AttributeLists,
                    fieldDeclaration2.Modifiers,
                    VariableDeclaration(
                        fieldDeclaration2.Declaration.Type,
                        SingletonSeparatedList(variables[i])));

                if (i == 0)
                {
                    newDeclaration = newDeclaration.WithLeadingTrivia(fieldDeclaration.GetLeadingTrivia());
                }

                if (i == variables.Count - 1)
                {
                    newDeclaration = newDeclaration.WithTrailingTrivia(fieldDeclaration.GetTrailingTrivia());
                }

                yield return(newDeclaration.WithFormatterAnnotation());
            }
        }
Пример #2
0
        public override void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node)
        {
            var docComment = node.GetLeadingTrivia().Select(i => i.GetStructure()).OfType <DocumentationCommentTriviaSyntax>().FirstOrDefault();

            _parsedMembers.Add(new ParsedMember(node, docComment));
            base.VisitEventFieldDeclaration(node);
        }