You are designing a Windows application that accesses information stored on a SharePoint 2010 intranet site.
The application displays employee information in a data grid sourced from a list on the Human Resources site. To
filter and manipulate the employee details list, the design includes a class to cache the data that is accessed. The
class keeps the SPWeb object open, but only retrieves data that is not already cached.
You need to ensure proper memory utilization and resource management for the application.
Which approach should you recommend?
A.
Implement the class with the IDisposable interface and allow the .NET Framework garbage collector to automatically manage the SPWeb object disposal.
B.
Implement the class with the IDisposable interface and explicitly dispose of the SharePoint SPWeb object when you are finished using it.
C.
Implement the class as a fully managed .Net Framework object and allow the .NET Framework garbage collector to automatically manage the SPWeb object disposal.
D.
Implement the class as a fully managed .Net Framework object and explicitly manage the SPWeb object using the ISPerformanceMonitor interface.
http://msdn.microsoft.com/en-us/library/aa973248(v=office.12).aspx
Calling applications that work with IDisposable objects in SharePoint Foundation must dispose the objects when the applications finish using them. You should not rely on the garbage collector to release them from memory automatically.