Best practice regarding returning from using blocks
- by abatishchev
Which way is better practice: return a value from a method inside an using statement or declare a variable before, set it inside and return it after?
public int Foo()
{
using(..)
{
return bar;
}
}
or
public int Foo()
{
var b = null;
using(..)
{
b = bar;
}
return b;
}