Пример #1
0
        public static RecordDeclarationSyntax RemoveMember(RecordDeclarationSyntax recordDeclaration, MemberDeclarationSyntax member)
        {
            if (recordDeclaration == null)
            {
                throw new ArgumentNullException(nameof(recordDeclaration));
            }

            if (member == null)
            {
                throw new ArgumentNullException(nameof(member));
            }

            int index = recordDeclaration.Members.IndexOf(member);

            MemberDeclarationSyntax newMember = RemoveSingleLineDocumentationComment(member);

            recordDeclaration = recordDeclaration.WithMembers(recordDeclaration.Members.ReplaceAt(index, newMember));

            return(recordDeclaration.RemoveNode(recordDeclaration.Members[index], GetRemoveOptions(newMember)));
        }