Tiny cleanup. AddRange will now favor RecyclableList & RecyclableArrayList parameters.

This commit is contained in:
Marek Lemańczyk committed 2023-03-12 03:45:41 +01:00
1 parent c211fb6ee4
commit 5572c7c57c
1 file changed
+10 -10
+10 -10
View File
@@ -517,15 +517,9 @@ namespace Recyclable.Collections
public void AddRange(IEnumerable<T> source, int growByCount = RecyclableDefaults.MinPooledArrayLength) public void AddRange(IEnumerable<T> source, int growByCount = RecyclableDefaults.MinPooledArrayLength)
{ {
if (source is T[] sourceArray) if (source is RecyclableList<T> sourceRecyclableList)
{ {
AddRange(sourceArray); AddRange(sourceRecyclableList);
return;
}
if (source is List<T> sourceList)
{
AddRange(sourceList);
return; return;
} }
@@ -535,9 +529,15 @@ namespace Recyclable.Collections
return; return;
} }
if (source is RecyclableList<T> sourceRecyclableList) if (source is T[] sourceArray)
{ {
AddRange(sourceRecyclableList); AddRange(sourceArray);
return;
}
if (source is List<T> sourceList)
{
AddRange(sourceList);
return; return;
} }