/// <summary>
        /// Gets all items of the projects of a provided Solution.
        /// </summary>
        /// <param name="solution"></param>
        /// <returns></returns>
        public static List <ProjectItem> GetSolutionProjectItems(Solution solution)
        {
            var result = new List <ProjectItem>();

            foreach (Project item in solution.Projects)
            {
                if (item.ProjectItems != null)
                {
                    result.AddRange(VisualStudioHelper.GetProjectItems(item.ProjectItems));
                }
            }

            return(result);
        }
        /// <summary>
        /// Gets the items of the provided ProjectItems collection.
        /// </summary>
        /// <param name="itemsCollection"></param>
        /// <returns></returns>
        public static List <ProjectItem> GetProjectItems(ProjectItems itemsCollection)
        {
            var result = new List <ProjectItem>();

            foreach (ProjectItem item in itemsCollection)
            {
                result.Add(item);

                if (item.SubProject != null && item.SubProject.ProjectItems != null)
                {
                    result.AddRange(VisualStudioHelper.GetProjectItems(item.SubProject.ProjectItems));
                }

                if (item.ProjectItems != null)
                {
                    result.AddRange(VisualStudioHelper.GetProjectItems(item.ProjectItems));
                }
            }

            return(result);
        }
 /// <summary>
 /// Gets the project code files.
 /// </summary>
 /// <param name="project">Project from where to obtain the code files.</param>
 /// <returns></returns>
 public static IEnumerable <ProjectItem> GetProjectCodeFiles(Project project)
 {
     return(VisualStudioHelper.GetProjectItems(project.ProjectItems)
            .Where(i => i.Name.EndsWith(Resources.CSharpFileExtension))
            .OrderBy(i => i.Name));
 }