I was following an post example where I have a service like MyService and was wrapped in the using keyword like
(using MyService = new MyService())
{
}
After building, the compiler complained about the service needing to implement IDisposable so I added
public class MyService : IDisposable
{
void IDisposable.Dispose()
{
}
}
The compiler did not complained and the 'using' implementation seem to be working but I was told that is the wrong implementation. I got the IDisposable.Dispose() from one of the post here. Now most of the posts have implementions of add a public void Dispose(disposing).
I am looking for a easier way to Dispose versus multiple methods in a few services. Is there any easier way?
Thanks