Hi,
In sharepoint we are using like this
using(spsite objsite =new spsite(http://localhost:4141/marketing)
{
using(spweb objweb=objsite.openweb())
{
..................
}
}
In the above way we are writing code.Here we used the keyword "using" for spweb and spsite means here we are specifing scope.If i am not used for spweb using keyword means already using keyword is available for spsite, is it kill the whole obejcts in that scope after completing executing.Why we need to write again using keyword for spweb also?Can anyone help me to explore this question.
Loading
Ramesh PalaniappanPosted Jul 19, 2013, 8:38 AM
Iftikar HussainPosted Jul 19, 2013, 7:21 AM
using here means of properly and automatically close and dispose any object references implementing the IDisposable interface.
since spsite and spweb are different object, hence you need to use two time.
for more details please refer the below link
http://www.codeproject.com/Articles/17106/The-using-Keyword-in-C
Regards,
Iftikar