Skip to content

Commit

Permalink
Refactor WeakHashtable to replace ArrayList (#8655)
Browse files Browse the repository at this point in the history
Refactor WeakHashtable to replace ArrayList
  • Loading branch information
elachlan authored Feb 17, 2023
1 parent b577934 commit be187a3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/System.Windows.Forms/src/misc/WeakHashtable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ private void ScavengeKeys()
// Perform a scavenge through our keys, looking
// for dead references.
//
ArrayList? cleanupList = null;
List<WeakReference>? cleanupList = null;
foreach (object o in Keys)
{
if (o is WeakReference wr && !wr.IsAlive)
{
cleanupList ??= new ArrayList();

cleanupList ??= new();
cleanupList.Add(wr);
}
}
Expand Down

0 comments on commit be187a3

Please sign in to comment.