From 5572c7c57ca8856d58c679e0434b94ccee10ba26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Lema=C5=84czyk?= Date: Sun, 12 Mar 2023 03:45:41 +0100 Subject: [PATCH] Tiny cleanup. AddRange will now favor RecyclableList & RecyclableArrayList parameters. --- Recyclable.Collections/RecyclableList.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 3a4a6d1..cff289f 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -517,15 +517,9 @@ namespace Recyclable.Collections public void AddRange(IEnumerable source, int growByCount = RecyclableDefaults.MinPooledArrayLength) { - if (source is T[] sourceArray) + if (source is RecyclableList sourceRecyclableList) { - AddRange(sourceArray); - return; - } - - if (source is List sourceList) - { - AddRange(sourceList); + AddRange(sourceRecyclableList); return; } @@ -535,9 +529,15 @@ namespace Recyclable.Collections return; } - if (source is RecyclableList sourceRecyclableList) + if (source is T[] sourceArray) { - AddRange(sourceRecyclableList); + AddRange(sourceArray); + return; + } + + if (source is List sourceList) + { + AddRange(sourceList); return; }