Utils/Runtime/ArrayExtensions.cs
Alexander Filippov 029e02fd2f Update
2022-03-02 01:12:44 +01: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 };
}
var result = new T[array.Length + 1];
for (var i = 0; i < array.Length; i++)
{
result[i] = array[i];
}
result[array.Length] = item;
return result;
}
}
}