concat Summary Concatenates the specified element to the end of the array. Signatures Click on a signature to select it and view its documentation. public T[] concat(T element) public T[] concat(...T elements) public T[] concat(T[] array) public T[] concat(...T[] arrays) Usage public T[] concat(T element) public T[] concat(...T elements) public T[] concat(T[] array) public T[] concat(...T[] arrays) Returns A new array representing the original array with the concatenated element (via shallow copying). A new array representing the original array with the concatenated elements (via shallow copying). A new array representing the original array with the concatenated array (via shallow copying). A new array representing the original array with all concatenated arrays (via shallow copies). Parameters element The element to concatenate. Parameters elements The elements to concatenate. Parameters array The array to concatenate. Parameters arrays The arrays to concatenate. Description Concatenates the specified element to the end of the array. Unlike System.Array<T>.push, this method does not mutate the array. Concatenates the specified element(s) to the end of the array. Unlike System.Array<T>.push, this method does not mutate the array. Concatenates a shallow copy of the specified array to the current array. This method does not mutate the array. Concatenates shallow copies of the specified array(s) to the current array. This method does not mutate the array. Examples Basic Usage 12345import System; int[] arr = [ 1, 2, 3 ];Console.log(arr.concat(4)); // 1,2,3,4Console.log(arr); // 1,2,3 Basic Usage 12345import System; int[] arr = [ 1, 2, 3 ];Console.log(arr.concat(4, 5)); // 1,2,3,4,5Console.log(arr); // 1,2,3 Basic Usage 12345import System; int[] arr = [ 1, 2, 3 ];arr = arr.concat([ 4, 5, 6 ]); // assign back to 'arr' since 'concat' does not mutateConsole.log(arr); Basic Usage 12345import System; int[] arr = [ 1, 2, 3 ];arr = arr.concat([ 4, 5, 6 ], [ 7, 8, 9 ]); // assign back to 'arr' since 'concat' does not mutateConsole.log(arr); Share HTML | BBCode | Direct Link