The GroupBy
operator can be used to separate, or demultiplex, the elements from a single sequence into multiple sequences according to the specified
KeySelector. Each element from the sequence will be routed to the correct group according to its key. Groups are created and emitted the first time that an element with a new distinct key value is received from the source sequence.
Note
You can manipulate and schedule each of the group sequences downstream using other higher-order operators such as Merge, Concat or Switch.
The members used to generate the elements in each group sequence can be optionally specified using the ElementSelector property. If no element selector is specified, the original values from the source sequence will be used.