nerdexam
Microsoft

70-573 · Question #227

You create an event receiver. The ItemAdded method for the event receiver contains the following code segment. (Line numbers are included for reference only.) 01Dim recWeb As SPWeb = properties.Web…

The correct answer is D. wpManager.Web at line 09. See the full explanation below for the reasoning.

Question

You create an event receiver. The ItemAdded method for the event receiver contains the following code segment. (Line numbers are included for reference only.) 01Dim recWeb As SPWeb = properties.Web 03 Using web As SPWeb = siteCollection.OpenWeb() 04 Dim oWeb As PublishingWeb = PublishingWeb.GetPublishingWeb(web) 05 Dim pubWebs As PublishingWebCollection = oWeb.GetPublishingWebs() 06 For Each iWeb As PublishingWeb In pubWebs 07 Try 08 Dim page As SPFile = web.GetFile("/Pages/default.aspx") 09 Dim wpManager As SPLimitedWebPartManager = page.GetLimitedWebPartManager(PersonalizationScope.[Shared]) 10 Finally 11 If iWeb IsNot Nothing Then 12 iWeb.Close() 13 End If 14 End Try 15 Next 16 End Using 17 End Using You need to prevent the event receiver from causing memory leaks. Which object should you dispose of?

Options

  • AoWeb at line 04
  • BrecWeb at line 01
  • CwpManager at line 09
  • DwpManager.Web at line 09

How the community answered

(30 responses)
  • A
    10% (3)
  • B
    3% (1)
  • C
    3% (1)
  • D
    83% (25)

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice