Is it possible to force the use of "using" for disposable classes?
Posted
by Zanoni
on Stack Overflow
See other posts from Stack Overflow
or by Zanoni
Published on 2010-04-20T13:38:43Z
Indexed on
2010/04/20
13:43 UTC
Read the original article
Hit count: 226
I need to force the use of "using" to dispose a new instance of a class.
public class MyClass : IDisposable
{
...
}
using(MyClass obj = new MyClass()) // Force to use "using"
{
}
© Stack Overflow or respective owner