4
Reply

StreamWriter

George George

George George

Apr 15 2008 5:46 AM
3k

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)