From 63ddc19f455cef1cdec2bbf075ab844af6f2b6ca Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Tue, 26 Nov 2024 16:21:31 -0500 Subject: [PATCH] chore: Simplify for loop --- src/Uno.UWP/UI/Core/WeakEventHelper.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Uno.UWP/UI/Core/WeakEventHelper.cs b/src/Uno.UWP/UI/Core/WeakEventHelper.cs index 478d1f660eae..9803c412b2dc 100644 --- a/src/Uno.UWP/UI/Core/WeakEventHelper.cs +++ b/src/Uno.UWP/UI/Core/WeakEventHelper.cs @@ -75,12 +75,11 @@ private bool Trim() { lock (_lock) { - for (int i = 0; i < _handlers.Count; i++) + for (int i = _handlers.Count - 1; i >= 0; i--) { if (!_handlers[i].Target.IsAlive) { _handlers.RemoveAt(i); - i--; } }