Utils/Runtime/ArrayExtensions.cs
2021-08-16 04:45:10 +02:00

23 lines
489 B
C#

namespace Utils
{
public static class ArrayExtensions
{
public static T[] Append<T>(this T[] array, T item)
{
if (array == null)
{
return new T[] { item };
}
T[] result = new T[array.Length + 1];
for (int i = 0; i < array.Length; i++)
{
result[i] = array[i];
}
result[array.Length] = item;
return result;
}
}
}