I have a class that has streamwriter object declared on class level. sw is created in the class constructorI have methods that write to a file using sw. Something like:
internal class WriteData
// rest of the code
internal static class GlobalClass
internal static WriteData writeData;
This way GlobalClass is accessible throghout the application. The problem is next:
1) How can I close streamwriter object, I need it to be closed when writeData is going to be destroyed? Calling sw.Close() in writeData destructor doesn't work.
2) is there any way I can check weather streamwriter object is "open", that is, weather something has been written to a file, other than the usual class level boolean variable that will be set to true when the method for writing data has been called?
If this looks confusing, I will explain better what you didn't understand.