Welcome to the new DelphiDabbler Code Library Documentation.

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.

Concat<T> class method

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;

Description

Returns a concatenation of two arrays with elements of the same type.

The returned array contains shallow copies of the two arrays.

Parameters:

Returns:

Note

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.

Example

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;

See Also