Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

C# Streams

Mar 3 2003 11:05 AM
Does anyone know how to convert this Java code or C++ code to C#. The C# StreamWriter constructor takes a stream as an argument. Java: Class Example { private PrintStream _myOut; public Example(PrintStream s) { _myOut = new PrintStream(s); } public static void main(String args[]) { Example e = new Example(System.out); } }; C++: class Example { private: ostream& _myOut public: Example(ostream& s): _myOut(s) {} } main: Example e = new Example(cout); So how do you do it in C#?

Answers (3)