Which two actions should you perform?

You are an enterprise application developer. You create a component that uses unmanaged resources. You need to ensure that the component permits client developers to release the unmanaged resources as soon as they are no longer needed. You also need to guarantee that unmanaged resources are always released, even if a client developer fails to release them.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

You are an enterprise application developer. You create a component that uses unmanaged resources. You need to ensure that the component permits client developers to release the unmanaged resources as soon as they are no longer needed. You also need to guarantee that unmanaged resources are always released, even if a client developer fails to release them.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

A.
Implement a Dispose method. Call the GC.Collect method from inside the Dispose method.

B.
Implement a Dispose method. Release the unmanaged resource from inside the Dispose method.

C.
Override the Object.Finalize method. Call the Object.Finalize method from inside the finalizer of your component.

D.
Override the Object.Finalize method. Call the Dispose method from inside the finalizer of your
component.



Leave a Reply 0

Your email address will not be published. Required fields are marked *