From a221aeff481f7d76c1ff38f16707899e91197ddb Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Sat, 20 Jul 2024 20:25:52 +0200 Subject: [PATCH 1/2] replace ArrayList in ItemContainerGenerator with List --- .../System/Windows/Controls/ItemContainerGenerator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs index fef9bba1d7d..31301ef581d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs @@ -2061,7 +2061,8 @@ void AddEmptyGroupItem(CollectionViewGroup group) // add it to the list of placeholder items (this keeps it from being GC'd) if (_emptyGroupItems == null) - _emptyGroupItems = new ArrayList(); + _emptyGroupItems = new(); + _emptyGroupItems.Add(emptyGroupItem); } @@ -2798,7 +2799,7 @@ void OnRefresh() private ReadOnlyCollection _itemsReadOnly; private GroupStyle _groupStyle; private ItemContainerGenerator _parent; - private ArrayList _emptyGroupItems; + private List _emptyGroupItems; private int _alternationCount; private Type _containerType; // type of containers on the recycle queue From 5a480512cabff760689f716b29ea247488d27135 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Tue, 23 Jul 2024 09:17:20 +0200 Subject: [PATCH 2/2] use fully qualified type when initializing a new instance --- .../System/Windows/Controls/ItemContainerGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs index 31301ef581d..fb130167826 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ItemContainerGenerator.cs @@ -2061,7 +2061,7 @@ void AddEmptyGroupItem(CollectionViewGroup group) // add it to the list of placeholder items (this keeps it from being GC'd) if (_emptyGroupItems == null) - _emptyGroupItems = new(); + _emptyGroupItems = new List(); _emptyGroupItems.Add(emptyGroupItem); }