ICollection<T>.MoveTo Method

Overloads

MoveTo(ICollection<T>)

Moves the elements of the collection to the specified collection.

MoveTo(ICollection<T>, Predicate<T>)

Moves the elements of the collection that are matching the specified predicate to the specified collection.

MoveTo(ICollection<T>)

Moves the elements of the collection to the specified collection.

Delphi
function MoveTo(const collection: ICollection<T>): Integer

Parameters

collection
ICollection<T>

The collection to move the elements to.

Returns

Integer

The number of elements that were moved.

Exceptions

collection is nil .

Remarks

This internally uses Extract to make sure that objects from a list with OwnsObject are not getting destroyed.

MoveTo(ICollection<T>, Predicate<T>)

Moves the elements of the collection that are matching the specified predicate to the specified collection.

Delphi
function MoveTo(const collection: ICollection<T>; const predicate: Predicate<T>): Integer

Parameters

collection
ICollection<T>

The collection to move the elements to.

predicate
Predicate<T>

A function to test each element for a condition.

Returns

Integer

The number of elements that were moved.

Exceptions

collection is nil .

-or-

predicate is nil .

Remarks

This internally uses Extract to make sure that objects from a list with OwnsObject are not getting destroyed.