src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs
/// <summary>
/// Applies a change to the workspace that can do any number of project changes.
/// </summary>
/// <remarks>This is needed to synchronize with <see cref="ApplyChangeToWorkspace(Action{Workspace})" /> to avoid any races. This
/// method could be moved down to the core Workspace layer and then could use the synchronization lock there.</remarks>
Applies a change to the workspace that can do any number of project changes.
Applies a change to the workspace that can do any number of project changes .
public void ApplyBatchChangeToWorkspace(Func<CodeAnalysis.Solution, SolutionChangeAccumulator> mutation)
        {
            lock (_gate)
            {
                var oldSolution = this.CurrentSolution;
                var solutionChangeAccumulator = mutation(oldSolution);
                if (!solutionChangeAccumulator.HasChange)
                {
                    return;
                }
                SetCurrentSolution(solutionChangeAccumulator.Solution);
                RaiseWorkspaceChangedEventAsync(
                    solutionChangeAccumulator.WorkspaceChangeKind,
                    oldSolution,
                    solutionChangeAccumulator.Solution,
                    solutionChangeAccumulator.WorkspaceChangeProjectId,
                    solutionChangeAccumulator.WorkspaceChangeDocumentId);
            }
        }
public void ApplyBatchChangeToWorkspace ( Func < CodeAnalysis . Solution , SolutionChangeAccumulator > mutation ) { lock ( _gate ) { var oldSolution = this . CurrentSolution ; var solutionChangeAccumulator = mutation ( oldSolution ) ; if ( ! solutionChangeAccumulator . HasChange ) { return ; } SetCurrentSolution ( solutionChangeAccumulator . Solution ) ; RaiseWorkspaceChangedEventAsync ( solutionChangeAccumulator . WorkspaceChangeKind , oldSolution , solutionChangeAccumulator . Solution , solutionChangeAccumulator . WorkspaceChangeProjectId , solutionChangeAccumulator . WorkspaceChangeDocumentId ) ; } }
Applies a change to the workspace that can do any number of project changes.
Applies a change to the workspace that can do any number of project changes .
mutation
Func<CodeAnalysis.Solution, SolutionChangeAccumulator>
remarks
This is needed to synchronize with  to avoid any races. This
method could be moved down to the core Workspace layer and then could use the synchronization lock there.
This is needed to synchronize with to avoid any races . This method could be moved down to the core Workspace layer and then could use the synchronization lock there .