Replace `Hashtable` with `HashSet` by xtqqczze · Pull Request #25918 · PowerShell/PowerShell · GitHub
Skip to content

Replace Hashtable with HashSet#25918

Open
xtqqczze wants to merge 1 commit into
PowerShell:masterfrom
xtqqczze:hashset1
Open

Replace Hashtable with HashSet#25918
xtqqczze wants to merge 1 commit into
PowerShell:masterfrom
xtqqczze:hashset1

Conversation

@xtqqczze

Copy link
Copy Markdown
Contributor

Replace non-generic Hashtable with HashSet in src/System.Management.Automation/help/.

Related: #12958

@xtqqczze xtqqczze marked this pull request as ready for review August 26, 2025 20:43
@xtqqczze xtqqczze changed the title Replace Hashtable with HashSet in help Replace Hashtable with HashSet Aug 26, 2025
@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Aug 29, 2025
@iSazonov

Copy link
Copy Markdown
Collaborator

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@iSazonov

Copy link
Copy Markdown
Collaborator

@daxian-dbw Could you please merge?

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Sep 7, 2025
@iSazonov iSazonov requested a review from Copilot October 22, 2025 11:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the codebase by replacing non-generic Hashtable collections with generic HashSet<string> in help provider classes. This change improves type safety and follows modern C# best practices.

  • Replaces Hashtable with HashSet<string> for tracking loaded help files
  • Updates corresponding API calls from hashtable indexing to HashSet.Add() and HashSet.Contains()
  • Removes unnecessary System.Collections imports

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ProviderHelpProvider.cs Replaced Hashtable with HashSet<string> for _helpFiles field and updated usage
PSClassHelpProvider.cs Replaced Hashtable with HashSet<string> for _helpFiles field and updated usage
MUIFileSearcher.cs Replaced Hashtable with HashSet<string> for _uniqueMatches field and optimized duplicate checking logic
HelpFileHelpProvider.cs Replaced Hashtable with HashSet<string> for _helpFiles field and updated all usage patterns
DscResourceHelpProvider.cs Replaced Hashtable with HashSet<string> for _helpFiles field and updated usage
CommandHelpProvider.cs Replaced Hashtable with HashSet<string> for _helpFiles field and updated usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants