This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.
Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.
Project: Array Utilities Unit
Unit: DelphiDabbler.Lib.ArrayUtils
Record: TArrayUtils
Applies to: ~>0.1
class function Concat<T>(const A, B: array of T): TArray<T>;
static;
Returns a concatenation of two arrays with elements of the same type.
The returned array contains shallow copies of the two arrays.
Parameters:
A - The first array to be copied.
B - The second array to be copied.
Returns:
If a deep copy of the concatenated array is required, pass the return value of Concat<T> to the deep copying overload of Copy<T> along with a suitable TCloner<T> implementation.
procedure Concat_Eg;
var
A, B, Got, Expected: TArray<Integer>;
begin
A := TArray<Integer>.Create(1, 2, 3, 4);
B := TArray<Integer>.Create(42, 56);
Got := TArrayUtils.Concat<Integer>(A, B);
Expected := TArray<Integer>.Create(1, 2, 3, 4, 42, 56);
Assert(TArrayUtils.Equal<Integer>(Expected, Got));
end;