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#?