private static SyntaxNode?FindFirstNonNestedClass( ISyntaxFactsService syntaxFacts, SyntaxList <SyntaxNode> members, CancellationToken cancellationToken) { foreach (var member in members) { cancellationToken.ThrowIfCancellationRequested(); if (syntaxFacts.IsBaseNamespaceDeclaration(member)) { var firstClass = FindFirstNonNestedClass( syntaxFacts, syntaxFacts.GetMembersOfBaseNamespaceDeclaration(member), cancellationToken); if (firstClass != null) { return(firstClass); } } else if (syntaxFacts.IsClassDeclaration(member)) { return(member); } } return(null); }