From 583d505b6e045671dcea5659c2647277db14a043 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Wed, 6 Nov 2024 22:55:45 +0100 Subject: [PATCH] NLogMessageParameterList - Optimize check of CaptureType for index operator --- .../Logging/NLogMessageParameterList.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/NLog.Extensions.Logging/Logging/NLogMessageParameterList.cs b/src/NLog.Extensions.Logging/Logging/NLogMessageParameterList.cs index dd9da4ef..f54e532e 100644 --- a/src/NLog.Extensions.Logging/Logging/NLogMessageParameterList.cs +++ b/src/NLog.Extensions.Logging/Logging/NLogMessageParameterList.cs @@ -179,10 +179,7 @@ public MessageTemplateParameter this[int index] { get { - if (index >= _originalMessageIndex) - index += 1; - - var parameter = _parameterList[index]; + var parameter = _parameterList[index >= _originalMessageIndex ? index + 1 : index]; return _hasComplexParameters ? GetMessageTemplateParameter(parameter.Key, parameter.Value) : new MessageTemplateParameter(parameter.Key, parameter.Value, null, CaptureType.Normal);