コード例 #1
0
    /// <summary>
    /// Finds all projects in the solution matching the given predicate.
    /// </summary>
    /// <param name="solution">The solution to traverse.</param>
    /// <param name="predicate">Predicate used to match projects.</param>
    /// <returns>All project nodes matching the given predicate that were found.</returns>
    public static IEnumerable <IProjectNode> FindProjects(this ISolutionNode solution, Func <IProjectNode, bool> predicate)
    {
        var visitor = new FilteringProjectsVisitor(predicate);

        solution.Accept(visitor);

        return(visitor.Projects);
    }
コード例 #2
0
    /// <summary>
    /// Finds the first project in the solution matching the given predicate.
    /// </summary>
    /// <param name="solution">The solution to traverse.</param>
    /// <param name="predicate">Predicate used to match projects.</param>
    /// <returns>The first project matching the given predicate, or <see langword="null"/>.</returns>
    public static IProjectNode FindProject(this ISolutionNode solution, Func <IProjectNode, bool> predicate)
    {
        var visitor = new FilteringProjectsVisitor(predicate, true);

        solution.Accept(visitor);

        return(visitor.Projects.FirstOrDefault());
    }
コード例 #3
0
        /// <summary>
        /// Finds all the project nodes in the solution.
        /// </summary>
        /// <param name="solution">The solution to traverse.</param>
        /// <returns>All project nodes that were found.</returns>
        public static IEnumerable <IProjectNode> FindProjects(this ISolutionNode solution)
        {
            var visitor = new ProjectsVisitor();

            solution.Accept(visitor);

            return(visitor.Projects);
        }