The examples in this topic demonstrate how to combine events from different streams by using a union operation. A union operation takes two input streams and combines the events to produce a single output event stream. A union operates on two streams and combines them into one stream.

The following example combines all events from stream1 with the events in stream2 into a single stream.

var unioned = stream1.Union(stream2);  

The following example demonstrates how to union more than two streams by performing cascades of unary union calls. The first call combines the events from stream1 with the events from stream2. The resulting stream, unionTmp, is then combined with stream3 to produce the final output stream unionFinal.

var unionTmp = stream1.Union(stream2);  
var unionFinal = unionTmp.Union(stream3);