70-573 · Question #254
You deploy a custom Web Part named WebPart1 to a SharePoint site. WebPart1 contains the following code segment. (Line numbers are included for reference only.) 01 protected void Page_Load(object…
The correct answer is C. Add the following line of code at line 17. MNEMONIC RULE: "finally dispose" Disposing Objects
Question
You deploy a custom Web Part named WebPart1 to a SharePoint site. WebPart1 contains the following code segment. (Line numbers are included for reference only.) 01 protected void Page_Load(object sender, EventArgs e) 02 { 03 SPSite site = null; 04 try 05 { 07 SPWeb web = site.OpenWeb(); 08 09 ... 10 } 11 catch 12 { 13 14 } 15 finally 16 { 17 18 } 19 } After you deploy WebPart1, users report that the pages on the site load slowly. You retract WebPart1 from the site. Users report that the pages on the site load without delay. You need to modify the code in WebPart1 to prevent the pages from loading slowly. What should you do?
Options
- AAdd the following line of code at line 08:
- BAdd the following line of code at line 13:
- CAdd the following line of code at line 17:
- DAdd the following line of code at line 17:
How the community answered
(31 responses)- A10% (3)
- B3% (1)
- C84% (26)
- D3% (1)
Explanation
MNEMONIC RULE: "finally dispose" Disposing Objects
Topics
Community Discussion
No community discussion yet for this question.