Skip to content

CastingEnumerable

QuantConnect.Util.CastingEnumerable

CastingEnumerable(
    data: Sequence[
        QuantConnect_Util_CastingEnumerable_TBase
    ],
)

Bases: Generic[QuantConnect_Util_CastingEnumerable_TBase, QuantConnect_Util_CastingEnumerable_TDerived], Object, Sequence[QuantConnect_Util_CastingEnumerable_TDerived], Iterable[QuantConnect_Util_CastingEnumerable_TDerived]

Defines a list that casts the elements of a source list to a derived type. This is useful to avoid materializing another list after using, for example, the Enumerable.Cast{TResult}(IEnumerable) LINQ method.

Initializes a new instance of the CastingEnumerable{TBase, TDerived} class

count

count: int

Gets the count of items in the enumerable.

__getitem__

__getitem__(
    index: int,
) -> QuantConnect_Util_CastingEnumerable_TDerived

Gets the element at the specified index.

Parameters:

Name Type Description Default
index int

The zero-based index of the element to get.

required

Returns:

Type Description
QuantConnect_Util_CastingEnumerable_TDerived

The element at the specified index.

__iter__

__iter__() -> (
    Iterator[QuantConnect_Util_CastingEnumerable_TDerived]
)

__len__

__len__() -> int

get_enumerator

get_enumerator() -> (
    IEnumerator[
        QuantConnect_Util_CastingEnumerable_TDerived
    ]
)

Returns an enumerator that iterates through the collection.

Returns:

Type Description
IEnumerator[QuantConnect_Util_CastingEnumerable_TDerived]

An enumerator that can be used to iterate through the collection.