/// <summary> /// Get unused references of projects list. /// </summary> /// <param name="projectsInfo">The list of projects.</param> /// <returns>Returns unused references for porjects.</returns> private IInspectResult GetUnusedReferences(IEnumerable <ProjectInfo> projectsInfo) { var sharedData = new ConcurrentBag <IProjectInspectResult>(); var loopOptions = new ParallelOptions(); loopOptions.MaxDegreeOfParallelism = Environment.ProcessorCount; using (ReferenceInspector referenceResolver = new ReferenceInspector()) { Parallel.ForEach <ProjectInfo>(projectsInfo, loopOptions, (projectInfo) => { try { var result = referenceResolver.Inspect(new ProjectEvaluator(projectInfo)); sharedData.Add(result); } catch (Exception ex) { sharedData.Add(new ProjectInspectResult(projectInfo, ex)); } }); } return(new InspectResult(sharedData)); }
/// <summary> /// Gets unused references. /// </summary> /// <param name="projectInfo">Project info.</param> /// <returns>Unused references.</returns> private IInspectResult GetUnusedReferences(ProjectInfo projectInfo) { using (ReferenceInspector referenceResolver = new ReferenceInspector()) { return(new InspectResult(new[] { referenceResolver.Inspect(new ProjectEvaluator(projectInfo)) })); } }