If I have a class with the file stream members like so:
public class FooBar
{
private StreamReader reader;
private StreamWriter writer;
public FooBar(string readerFilePath, string writerFilePath)
{
reader = new StreamReader(readerFilePath);
writer = new StreamWriter(writerFilePath);
}
...
}
then how do I close those streams?
It seems that they are closed by default during the class destruction, but then I have to use writer.Flush()
which doesn't sound good.