PreAppend extension optimization.

This commit is contained in:
Karolis2011
2019-08-20 00:27:58 +03:00
parent 913b69bdf4
commit 568c45ad87

View File

@@ -8,6 +8,10 @@ namespace ASS.Server.Extensions
{
public static T[] PreAppend<T>(this T[] array, params T[] toAppend)
{
if (array.Length == 0)
return toAppend;
if (toAppend.Length == 0)
return array;
var n = new T[toAppend.Length + array.Length];
toAppend.CopyTo(n, 0);
array.CopyTo(n, toAppend.Length);