nerdexam
Microsoft

70-573 · Question #255

You have a Web Part that contains the following code segment. (Line numbers are included for reference only.) 01 protected void Page_Load(object sender, EventArgs e) 02 { 04 { 05 SPWeb web =…

The correct answer is D. Change line 03 to the following code segment. MNEMONIC RULE: "using statement" You can automatically dispose SharePoint objects that implement the IDisposable interface by using theMicrosoft Visual C# and Visual Basic using statement. Disposing Objects

Developing SharePoint Solutions

Question

You have a Web Part that contains the following code segment. (Line numbers are included for reference only.) 01 protected void Page_Load(object sender, EventArgs e) 02 { 04 { 05 SPWeb web = site.OpenWeb(); 06 07 } 08 } You deploy the Web Part to a SharePoint site. After you deploy the Web Part, users report that the site loads slowly. You need to modify the Web Part to prevent the site from loading slowly. What should you do?

Options

  • AAdd the following line of code at line 06:
  • BAdd the following line of code at line 06:
  • CAdd the following line of code at line 06:
  • DChange line 03 to the following code segment:

How the community answered

(28 responses)
  • A
    4% (1)
  • B
    14% (4)
  • C
    7% (2)
  • D
    75% (21)

Explanation

MNEMONIC RULE: "using statement" You can automatically dispose SharePoint objects that implement the IDisposable interface by using theMicrosoft Visual C# and Visual Basic using statement. Disposing Objects

Topics

#SPWeb disposal#using statement#memory management#Web Part development

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice