1
Answer

dispose wrapped resource

George George

George George

16y
1.9k
1

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)