I agree with another answering machine that you should look at your design to see if the recording method is really line level.
However, I do not agree with the point of view
"All he does is call back to the base class' (TextWriter) Dispose - which does nothing."
When using classes, if the type implements Dispose , you really have to call it, explicitly or using "use".
In this case, it is true that StringWriter.Dispose calls up to TextWriter.Dispose , which does nothing, but I really do not advise "just ignore it."
The whole nature and polymorphism is that this type can be replaced by a derived type.
Today, StringWriter in your code can be replaced tomorrow with EvenBetterStringWriter , which may have a more meaningful implementation for Dispose .
If it implements Dispose and you use it, you should seriously consider making a call when you are done.
Having privileged knowledge about the insides of this particular concrete implementation is dangerous when you allow it to be guided by your design like that. The author of the StringWriter class StringWriter clearly intended to call Dispose, or it would not be there.
Rob levine
source share