CSharp · Console
using System;
using System.Linq;
public static class Extensions
{
public static void Add<T>(this T[] _self, T item)
{
//Array.Resize(ref _self, _self.Length + 1);
//_self[_self.Length - 1] = item;
_self = _self.Concat(new T[] { item }).ToArray();
}
}
public class Program
{
public static void Main()
{
string[] test = { "Hello" };
test = test.Concat(new string[] { "cruel" }).ToArray();
test.Add("but funny");
Console.WriteLine(String.Join(" ", test) + " world");
}
}