4
Answers

StreamWriter

George George

George George

16y
3.1k
1

Hello everyone,


For example, my class Foo wraps an object of StreamWriter, I must make Foo implements IDisposable and in the Dispose method of class Foo, invoke Dispose method of the StreamWriter object instance to release resource properly?

[Code]
using System.IO;


public class Foo : IDisposable
{
    StreamWriter a;

    public Foo()
 {

 }

    public void Dispose
    {
        if (null != a)
        {
            a.Dispose();
        }
    }

}
[/Code]


thanks in advance,
George

Answers (4)