George George

George George

  • NA
  • 778
  • 0

dispose wrapped resource

Apr 15 2008 10:56 AM

Hello everyone,


For the following code pattern, suppose both Base class and Component class are implementing IDisposable.

In the destructor of Foo class, there is no need to call Dispose method of Base class and Component class explicitly, and they will be called automatically during the Finalize process of Foo instance?

[Code]
Class Foo : Base
{
 private Component component = new Component();

 ~Foo()
 {
  // component's Dispose method will be called automatically?

  // Base's Dispose method will be called automatically?
 }

}
[/Code]


thanks in advance,
George


Answers (1)