You need to ensure that the Web Part activates a Feature in the subsite without causing a memory leak.Which code segment should you use?

You are creating a Web Part. The Web Part will be used in a SharePoint subsite that has the URL
http://www.contoso.com/hr.You need to ensure that the Web Part activates a Feature in the
subsite without causing a memory leak.Which code segment should you use?

You are creating a Web Part. The Web Part will be used in a SharePoint subsite that has the URL
http://www.contoso.com/hr.You need to ensure that the Web Part activates a Feature in the
subsite without causing a memory leak.Which code segment should you use?

A.
Dim featuresCollect As SPFeatureCollection = SPContext.Current.SiteFeatures
featuresCollect.Add(New Guid(“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”), True)

B.
Dim featuresCollect As SPFeatureCollection = SPContext.Current.WebFeatures
featuresCollect.Add(New Guid(“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”), True)

C.
Dim web As New SPSite(“http://www.contoso.com/hr”) Dim featureCollect As
SPFeatureCollection = web.Features featureCollect.Add(New
Guid(“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”), True)

D.
Dim web As SPWeb = New SPSite(“http://www.contoso.com/hr”).OpenWeb() Dim
featureCollect As SPFeatureCollection = web.Features featureCollect.Add(New
Guid(“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”), True)



Leave a Reply 0

Your email address will not be published. Required fields are marked *