Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Not disposed the object in un used method in code

$
0
0

Hi,

In my C# code, I have a method defined but not called any where as I am not using the functionality.But when I run SPDIsposerCheck in my code , the tool identified below mentioned method with error "Disposable type not disposed".

SO will this error message affects the performance as the below method is no where used in my code ?

 public string GetServer(string siteurl)
        {

              SPSecurity.RunWithElevatedPrivileges(delegate()
            {
         
                // Retrieve a site collection by URL.
                using (SPSite site = new SPSite(siteurl))
                {
                   SPWeb spweb = site.RootWeb;

                      
            });
            }


Knowledge is power.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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