From ffe26ce676092e8cdc17505c48e17c07758bf1b2 Mon Sep 17 00:00:00 2001 From: Jose Medrano Date: Fri, 25 Feb 2022 06:26:47 +0100 Subject: Caches RowCount into variable to avoid unnecessary native calls on each iteration --- Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs index f8448ec..0f2cec0 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs @@ -123,7 +123,8 @@ namespace Xamarin.PropertyEditing.Mac NSView view; PropertyEditorControl ctrl = null; - for (; reverse ? row > 0 : row < TableView.RowCount; row += modifier) { + var rowCount = TableView.RowCount; + for (; reverse ? row > 0 : row < rowCount; row += modifier) { view = TableView.GetView (0, row, makeIfNecessary: false); if (view is PropertyEditorControl pec) { // This is to include the CategoryContainer -- cgit v1.2.3