Which one of the below 2 code pieces is not calling dispose and therefore is bad practice:
...
using(SomeIDisposable p = new SomeIDisposable())
{
return p.Get开发者_如何学CSomething(...);
}
...
or
...
return new SomeIDisposable().GetSomething(...);
...
?
Number two does not call dispose.
精彩评论