Table of Contents

Marble diagram

ToList emits a single list of the same type as the type of the elements in the source sequence. The list is emitted when the source sequence completes successfully.

Warning

If the source sequence is infinite (i.e. does not terminate), this operator will never emit the collection, and will keep accumulating all elements from the source sequence indefinitely, with likely impacts on available memory.

Examples

Use ToList to create a list with every element in an observable sequence.

ToList Example

Use ToArray if you do not need to add or remove elements from the collection.