public static IEnumerable <ITypeElement> FindFirstTypeWithinCodeFiles(ISolution solution, Regex regex, IProject project) { List <ProjectFileFinder.Match> items = new List <ProjectFileFinder.Match>(); project.Accept(new ProjectFileFinder(items, regex)); return(items .SelectMany(p => solution.GetPsiServices().Symbols.GetTypesAndNamespacesInFile(p.ProjectFile.ToSourceFile())) .OfType <ITypeElement>()); }