TCollections.CreateList<T> Method

Overloads

CreateList<T>

Creates a resizable list of values.

CreateList<T>(IEqualityComparer<T>)

Creates a resizable list that uses an equality comparer for lookup operations.

CreateList<T>

Creates a resizable list of values.

Delphi
class function CreateList<T>: IList<T>; overload; static;

Type Parameters

T

The type of values in the list.

Returns

IList<T>

A new IList<T> instance.

Examples

delphi

  var
    Names: IList<string>;
  begin
    Names := TCollections.CreateList<string>;
    Names.AddRange(['Ada', 'Grace']);
  end;

CreateList<T>(IEqualityComparer<T>)

Creates a resizable list that uses an equality comparer for lookup operations.

Delphi
class function CreateList<T>(const Comparer: IEqualityComparer<T>): IList<T>; overload; static;

Type Parameters

T

The type of values in the list.

Parameters

Comparer
IEqualityComparer<T>

The IEqualityComparer<T> used by lookup operations such as IReadOnlyCollection<T>.Contains and IList<T>.IndexOf.

Returns

IList<T>

A new IList<T> instance.

Remarks

If Comparer is nil, the list uses the default equality comparer for type T. Sorting still uses the comparer or comparison callback passed to IList<T>.Sort.