2021-01-18 08:38:32 -08:00
|
|
|
/*************************************************************************
|
|
|
|
|
* ModernUO *
|
2023-08-09 09:09:26 -07:00
|
|
|
* Copyright 2019-2023 - ModernUO Development Team *
|
2021-01-18 08:38:32 -08:00
|
|
|
* Email: hi@modernuo.com *
|
|
|
|
|
* File: CollectionHelpers.cs *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2021-08-08 21:37:25 -07:00
|
|
|
using System.Runtime.CompilerServices;
|
2021-01-18 08:38:32 -08:00
|
|
|
|
2022-10-10 21:47:08 -07:00
|
|
|
namespace Server.Collections;
|
|
|
|
|
|
|
|
|
|
public static class CollectionHelpers
|
2021-01-18 08:38:32 -08:00
|
|
|
{
|
2022-10-10 21:47:08 -07:00
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
public static void AddNotNull<T>(this ICollection<T> coll, T t) where T : class
|
2021-01-18 08:38:32 -08:00
|
|
|
{
|
2022-10-10 21:47:08 -07:00
|
|
|
if (t != null)
|
2021-01-18 08:38:32 -08:00
|
|
|
{
|
2022-10-10 21:47:08 -07:00
|
|
|
coll.Add(t);
|
2021-01-18 08:38:32 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|