Why does HttpListener explicitly implement IDisposable. This means you have to cast to IDisposable before calling dispose and in my opinion makes the fact you have to call dispose less obvious.
Why does HttpListener explicitly implement IDisposable. This means you have to cast to IDisposable
Share
You don’t need an explicit cast if you use a
usingblock. (This is the preferred idiom, where possible, for dealing withIDisposableobjects.)It has a
Closemethod which is pretty-much an alias forDispose. (Not my favourite pattern, but the framework designers seem to like it!)