I have service which does not implement IDisposable in its class. While creating object for class, I putting object creation statement in Using statement. I executed the code, it not giving any error. Can you explain why the creation object which does not implement IDisposable not throwing exception in using statement.
1 Answer
No. That is not possible.
If you use this code:
using (object o = new object())
{ }
You receive:
'object': type used in a using statement must be implicitly convertible to 'System.IDisposable'
The easy reason you won't see it implements IDisposable is that one of its base classes implements IDisposable.
IDisposable. Post the code you're talking about.