From 92aff1ba8d9884782d9857fc4905f038464e4403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Sat, 13 Jun 2026 16:05:45 +0200 Subject: [PATCH] simplify: replace BuildEvaluators for-loop with Array.ConvertAll method group Replace the manual for-loop in BuildEvaluators with Array.ConvertAll and a method group reference to BuildEvaluator. Array.ConvertAll is available on netstandard2.0+, avoids a separate array allocation followed by index assignment, and expresses the intent (convert each element) more directly than an explicit loop. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Attributes/TestMethod/MemberConditionAttribute.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/TestFramework/TestFramework/Attributes/TestMethod/MemberConditionAttribute.cs b/src/TestFramework/TestFramework/Attributes/TestMethod/MemberConditionAttribute.cs index 5d1d1ffd2d..2ac6b4e07d 100644 --- a/src/TestFramework/TestFramework/Attributes/TestMethod/MemberConditionAttribute.cs +++ b/src/TestFramework/TestFramework/Attributes/TestMethod/MemberConditionAttribute.cs @@ -228,15 +228,7 @@ public override bool IsConditionMet } private Func[] BuildEvaluators() - { - var evaluators = new Func[_conditionMemberNames.Length]; - for (int i = 0; i < _conditionMemberNames.Length; i++) - { - evaluators[i] = BuildEvaluator(_conditionMemberNames[i]); - } - - return evaluators; - } + => Array.ConvertAll(_conditionMemberNames, BuildEvaluator); private Func BuildEvaluator(string memberName) {