Table of Contents

Marble diagram

ToDictionary collects all the values from the source sequence and creates a dictionary mapping keys to elements using the specified KeySelector and ElementSelector properties. The dictionary is emitted when the source sequence completes successfully, and will have key and element types matching the selected members.

Warning

If the source sequence emits a value with a duplicate key, an error will be raised and the sequence will terminate exceptionally.

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.