GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix MatchInfoContext clone implementation (#5121) · PowerShell/PowerShell@81c46c6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/Microsoft.PowerShell.Commands.Utility/commands/utility
    • MatchString.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ internal MatchInfoContext()
6161
/// </summary>
6262
public object Clone()
6363
{
64-
MatchInfoContext clone = new MatchInfoContext();
65-
clone.PreContext = (clone.PreContext != null) ? (string[])PreContext.Clone() : null;
66-
clone.PostContext = (clone.PostContext != null) ? (string[])PostContext.Clone() : null;
67-
clone.DisplayPreContext = (clone.DisplayPreContext != null) ? (string[])DisplayPreContext.Clone() : null;
68-
clone.DisplayPostContext = (clone.DisplayPostContext != null) ? (string[])DisplayPostContext.Clone() : null;
69-
return clone;
64+
return new MatchInfoContext()
65+
{
66+
PreContext = (string[])PreContext?.Clone(),
67+
PostContext = (string[])PostContext?.Clone(),
68+
DisplayPreContext = (string[])DisplayPreContext?.Clone(),
69+
DisplayPostContext = (string[])DisplayPostContext?.Clone()
70+
};
7071
}
7172
}
7273

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.