combination-stream: Single stream representing multiple streams

From the author of the excellent SimpleJson, a single source file nuget package containing a combination stream:  support sync and async reading from multiple stream (facebook-csharp-sdk/combination-stream: Single stream representing multiple streams).

Streams should be provided in constructor as IList and are automatically disposed unless using an overloaded constructor taken indexes to dispose.

Reading source code I was thinking to a more dynamic version using an IEnumerable and a delagate responsible of the disposal part. The delegate could take an index and the Stream.

Searching for such an implementation, I’ve found this SO question where Jon Skeet propose similar specifications (at east for the IEnumerable part) and someone called prabirshrestha propose an implementation (without the IEnumarable part). The circle is complete: prabirshrestha is the author of facebook-csharp-sdk/combination-stream.

EDIT: More googling gives an implementation from Marc Gravell which is truly lazy (by far the better response of corresponding question).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s