PreAppend extension optimization.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user