TEnumerable.OfType<T,TResult> Method

Definition

Filters the elements of a sequence based on a specified type.

Delphi
class function OfType<T,TResult>(const source: IEnumerable<T>): IEnumerable<TResult>

Type Parameters

T

The type of the elements of source .

TResult

The type to filter the elements of the sequence on.

Parameters

source
IEnumerable<T>

The sequence whose elements to filter.

Returns

IEnumerable<TResult>

A sequence that contains elements from the input sequence of type TResult .

Exceptions

source is nil .