Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor BaseContextMenuStrip to replace ArrayList with List<T> #8668

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#nullable disable

using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
Expand Down Expand Up @@ -80,7 +79,7 @@ private void RefreshSelectionMenuItem()
Items.Remove(selectionMenuItem);
}

ArrayList parentControls = new ArrayList();
List<Component> parentControls = new();
int nParentControls = 0;

// Get the currently selected Control
Expand Down Expand Up @@ -127,9 +126,9 @@ private void RefreshSelectionMenuItem()
selectionMenuItem.DropDown.Renderer = (ToolStripProfessionalRenderer)uis.Styles["VsRenderer"];
//Set the right Font
selectionMenuItem.DropDown.Font = (Font)uis.Styles["DialogFont"];
if (uis.Styles["VsColorPanelText"] is Color)
if (uis.Styles["VsColorPanelText"] is Color color)
{
selectionMenuItem.DropDown.ForeColor = (Color)uis.Styles["VsColorPanelText"];
selectionMenuItem.DropDown.ForeColor = color;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ protected bool Visible
}

/// <summary>
/// This method adds the Parent Hierarchy to arraylist and returns that arraylist to the
/// This method adds the Parent Hierarchy to a list and returns that list to the
/// Base ContextMenu provider. This way the ToolStripItem can show the right parents in
/// the contextMenu.
/// </summary>
internal ArrayList AddParentTree()
internal List<Component> AddParentTree()
{
ArrayList parentControls = new ArrayList();
List<Component> parentControls = new();
if (!TryGetService(out IDesignerHost designerHost))
{
return parentControls;
Expand Down