From 14843ddebad3173af026d5d727220ddbabc6744e Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 28 Jun 2025 12:50:03 +0300 Subject: [PATCH] refactor: removed unnecessary linq call --- Engine.Core/BehaviourController.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Engine.Core/BehaviourController.cs b/Engine.Core/BehaviourController.cs index 5e4855f..9334871 100644 --- a/Engine.Core/BehaviourController.cs +++ b/Engine.Core/BehaviourController.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; namespace Syntriax.Engine.Core; @@ -50,17 +49,13 @@ public class BehaviourController : BaseEntity, IBehaviourController public IReadOnlyList GetBehaviours() { - List? behaviours = null; + List behaviours = []; + foreach (IBehaviour behaviourItem in this.behaviours) - { - if (behaviourItem is not T behaviour) - continue; + if (behaviourItem is T behaviour) + behaviours.Add(behaviour); - behaviours ??= []; - behaviours.Add(behaviour); - } - - return behaviours ?? Enumerable.Empty().ToList(); + return behaviours; } public void GetBehaviours(IList results)