CSharp · Console
using System;
public class Program
{
public static void ArrayPush<T>(ref T[] table, object value)
{
Array.Resize(ref table, table.Length + 1); // Resizing the array for the cloned length (+-) (+1)
table.SetValue(value, table.Length - 1); // Setting the value for the new element
}
public static void Main()
{
string[] fruits = {"apple", "orange"};
ArrayPush(ref fruits, "banana");
Array.ForEach(fruits, (e) => Console.WriteLine(e));
// "apple"
// "orange"
// "banana"
}
}