George George

George George

  • NA
  • 778
  • 0

StreamWriter

Apr 15 2008 5:46 AM

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)