Skip to content

Commit

Permalink
Prefer SetItem over Add for ImmutableDictionary (#919)
Browse files Browse the repository at this point in the history
This handles the odd case where an item already exists in the dictionary - it's just safer this way.
  • Loading branch information
dalyIsaac authored Jun 28, 2024
1 parent 2f6dc23 commit 49a78b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private static IWindow Setup_WindowPosition(IContext ctx, MutableRootSector root

workspace = workspace with
{
WindowPositions = workspace.WindowPositions.Add(
WindowPositions = workspace.WindowPositions.SetItem(
window.Handle,
new WindowPosition(WindowSize.Minimized, new Rectangle<int>())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ IWindow window
? workspace
: workspace with
{
WindowPositions = workspace.WindowPositions.Add(window.Handle, new WindowPosition()),
WindowPositions = workspace.WindowPositions.SetItem(window.Handle, new WindowPosition()),

// Restore in just the active layout engine. MinimizeWindowEnd is not called as part of
// Whim starting up.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ IWindow window

workspace = workspace with
{
WindowPositions = workspace.WindowPositions.Add(window.Handle, new WindowPosition())
WindowPositions = workspace.WindowPositions.SetItem(window.Handle, new WindowPosition())
};

for (int idx = 0; idx < workspace.LayoutEngines.Count; idx++)
Expand Down

0 comments on commit 49a78b0

Please sign in to comment.