70-573 · Question #256
You create an event receiver. The ItemAdded method for the event receiver contains the following code segment. (Line numbers are included for reference only.) 01 SPWeb recWeb = properties.Web; 03 {…
The correct answer is D. wpManager.Web at line 13. MNEMONIC RULE: "sneaky, sneaky wpManager.Web" Gets the web that this Web Part Page is stored in. SPLimitedWebPartManager.Web Property us/library/microsoft.sharepoint.webpartpages.splimitedwebpartmanager.web.aspx
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.) 01 SPWeb recWeb = properties.Web; 03 { 04 using (SPWeb web = siteCollection.OpenWeb()) 05 { 06 PublishingWeb oWeb = PublishingWeb.GetPublishingWeb(web); 07 PublishingWebCollection pubWebs = oWeb.GetPublishingWebs(); 08 foreach (PublishingWeb iWeb in pubWebs) 09 { 10 try 11 { 12 SPFile page = web.GetFile("/Pages/default.aspx"); 13 SPLimitedWebPartManager wpManager = page.GetLimitedWebPartManager (PersonalizationScope.Shared); 14 } 15 finally 16 { 17 if (iWeb != null) 18 { 19 iWeb.Close(); 20 } 21 } 22 } 23 } 24 } You need to prevent the event receiver from causing memory leaks. Which object should you dispose of?
Options
- AoWeb at line 06
- BrecWeb at line 01
- CwpManager at line 13
- DwpManager.Web at line 13
How the community answered
(47 responses)- A2% (1)
- B4% (2)
- C13% (6)
- D81% (38)
Explanation
MNEMONIC RULE: "sneaky, sneaky wpManager.Web" Gets the web that this Web Part Page is stored in. SPLimitedWebPartManager.Web Property us/library/microsoft.sharepoint.webpartpages.splimitedwebpartmanager.web.aspx
Topics
Community Discussion
No community discussion yet for this question.