70-573 70-573 Schulungsunterlagen zertifizierung-portal 70-573 www.zertifizierung-portal.de
Prüfungsnummer : 70-573
Prüfungsnname: TS: Office SharePoint Server, Application Development (available in 2010)
70-573 70-573 70-573 www.zertifizierung-portal.de
QUESTION 2
You have a Web application that contains the following code segment.
private void CreatingSPSite()
{
SPSite siteCollection = null;
try
{
siteCollection = new SPSite(“http://contoso.com”);
}
finally
{
}
}
You need to prevent the code segment from causing a memory leak.
Which code segment should you add?
A. if (siteCollection != null)
{
siteCollection.Close();
}
B. if (siteCollection != null)
{
siteCollection.Dispose();
}
C. siteCollection = null;
D. siteCollection.WriteLocked = false;
Answer: B
Explanation/Reference:
MNEMONIC RULE: “Dispose of memory leak”
Difference between Close() and Dispose() Method
http://dotnetguts.blogspot.com/2007/06/difference-between-close-and-dispose.html