private List <CodeRefactoringProvider> GetSortedCodeRefactoringProviders() { var nodesList = new List <ProviderNode <CodeRefactoringProvider> >(); var providerList = new List <CodeRefactoringProvider>(); foreach (var provider in this.Providers) { foreach (var codeRefactoringProvider in provider.CodeRefactoringProviders) { providerList.Add(codeRefactoringProvider); nodesList.Add(ProviderNode <CodeRefactoringProvider> .From(codeRefactoringProvider)); } } var graph = Graph <CodeRefactoringProvider> .GetGraph(nodesList); if (graph.HasCycles()) { return(providerList); } return(graph.TopologicalSort()); }