I am creating an object(obj below) in using and return that object as part of the function return.Will this cause any problem like object will be disposed before I try to us
The object will be Dispose()
-d when it goes out of scope, whether by return
or some other codepath. The sole purpose of using
is to provide a failsafe mechanism for IDisposable
objects of local scope to get cleaned up whatever happens in the enclosed block of code.
That's going to result in problems in your calling function, so don't do this.