I like variables named correctly but in some cases it is very hard to do.
So if my object implements IDisposable
then I can use:
using (var whatever = new Whatever()) { //... }
But it is rare case, so I found another way to handle it - anonymous block (not sure how it called correctly):
//...
{
var whatever = new Whatever();
//...
}
//...
if (condition)
{
var whatever = new Whatever();
}
Is it a good approach? Are there any pitfalls or widespread belief that it reduces code readability?