Question C # - thread

When I wrote some I / O routine to C++, I usually made it as general as possible, working on interfaces from <iostream>.

For instance:

void someRoutine(std::istream& stream) { ... }

How to do it in C#?

I suspect that I can write my routines based on System.IO.TextReaderor System.IO.TextWriter, but I'm not sure.


Obviously, I am looking for the same base class in C#, which is common as std::istreamor std::ostreamthat can be extended in many ways (for example, as it boost::iostreamsextends std::threads).

+5
source share
4 answers

, TextReader TextWriter.

, Stream.

, FileStream, StringWriter NetworkStream.

+5

System.IO.Stream, . TextReader/TextWriter , , .

+3

Base class Stream. MemoryStream, FileStream, etc. Inherited from this class.

+1
source

You may have a C # function with a stream (System.IO.Stream), as in C ++. If necessary, depends on the function you are writing.

0
source

All Articles