Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Disposing Properties.Current.Web

$
0
0

Hi,

I have added a ItemAdded event, which has the code as below:

 public override void ItemAdded(SPItemEventProperties properties)
        {
SPListItem currentItem = properties.ListItem;

SPList testList = null;
SPListItem currentItem = null;

//get the current site
SPWeb currentSite = properties.Web;
           
 //get the list
if (currentSite != null)
{
testList = currentSite.Lists.TryGetList("My List");
}
if (testList != null)
{
// Other conditions
//Spquery 
 currentItem.Update();
}
}

How to dispose the SharePoint Objects?

Thanks


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>