Is there any difference between these tow pieces of code & which approach is better.
try
{
using()
{
//Do stuff
}
}
catch
{
//Handle exception
}
using()
{
try
{
//Do stuff
}
catch
{
//Handle exception
}
}
There are differences, but it namely boils down to the fact that a using block creates it own try and scope blocks.