What should you do?

You create a class library by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5.
When an instance of the class is created, the class acquires a handle from the WIN32 DLL and saves the handle to a data member.
You need to identify a strategy to ensure that the Win32 DLL handle releases resources when they are no longer being used.
What should you do?

You create a class library by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5.
When an instance of the class is created, the class acquires a handle from the WIN32 DLL and saves the handle to a data member.
You need to identify a strategy to ensure that the Win32 DLL handle releases resources when they are no longer being used.
What should you do?

A.
Extend the ContextBoundObject class.

B.
Include the SupressUnmanagedCode attribute.

C.
Call the GC.Collect method in the finalizer of the class.

D.
Implement the IDisposable interface, and include a Close method.



Leave a Reply 0

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