0

Java uses SequenceInputStream class to combine two or more streams into one single stream. I would like to know how someone can merge two or more streams in one stream in C# language.This is what i want to do in C# I have a NetworkStream nS1. From nS1 i created another Networkstream nS2 which contains the modified contents of nS1, then i want to create another NetworkStream nS3 which should be the combination of nS1 and nS2. Any idea how to go about that?

Kenzo
  • 1,767
  • 8
  • 30
  • 53
  • .NET has no such a feature which allows enumerating multiple streams, simple MemoryStream or FileStream, e.g. there are.. May be you can give an exampel of what are you trying to do so answer coudl be more specific – sll Nov 07 '11 at 10:49

2 Answers2

2

There's no such thing in the framework, but you can implement it yourself, as shown in the following question: How do I concatenate two System.Io.Stream instances into one?

Community
  • 1
  • 1
Zruty
  • 8,377
  • 1
  • 25
  • 31
  • Someone else provided an answer. Check this out :http://www.csharphelp.com/2007/03/combine-streams-in-a-single-c-stream-object/ – Kenzo Nov 07 '11 at 12:08
1

AFAIK there is nothing built in to the .Net framework for this. But I would personally have tried to write my own class for this.

However, it seems somebody may have done one for you, see if this is any good:

http://www.java2s.com/Open-Source/CSharp/Sound-Mp3/cspeex/java/io/SequenceInputStream.cs.htm

musefan
  • 47,875
  • 21
  • 135
  • 185