mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Remove usage of Nuget.Packaging
extension methods for IList.AddRange
This commit is contained in:
22
osu.Game/Extensions/CollectionExtensions.cs
Normal file
22
osu.Game/Extensions/CollectionExtensions.cs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Extensions
|
||||
{
|
||||
public static class CollectionExtensions
|
||||
{
|
||||
public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> items)
|
||||
{
|
||||
// List<T> has a potentially more optimal path to adding a range.
|
||||
if (collection is List<T> list)
|
||||
list.AddRange(items);
|
||||
else
|
||||
{
|
||||
foreach (T obj in items)
|
||||
collection.Add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user