Which code segment should you add?

You have a Web application that contains the following code segment. Private Sub
CreatingSPSite() Dim siteCollection As SPSite = Nothing Try siteCollection = New
SPSite(“http://contoso.com”) Finally End Try End Sub You need to prevent the code segment
from causing a memory leak. Which code segment should you add?

You have a Web application that contains the following code segment. Private Sub
CreatingSPSite() Dim siteCollection As SPSite = Nothing Try siteCollection = New
SPSite(“http://contoso.com”) Finally End Try End Sub You need to prevent the code segment
from causing a memory leak. Which code segment should you add?

A.
siteCollection.WriteLocked = false;

B.
if (siteCollection != null) { siteCollection.Close(); }

C.
if (siteCollection != null) { siteCollection.Dispose(); }

D.
siteCollection = null;



Leave a Reply 0

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