I have a class with this field:
private WcfChannelFactory<IPrestoService> _channelFactory;
In the Dispose()
method, I'm doing this:
if (_channelFactory != null) { _channelFactory.Dispose(); }
But that produces an error:
Cannot access explicit implementation of IDisposable.Dispose
After doing some research, it appears that I can dispose this way:
if (_channelFactory != null) { (_channelFactory as IDisposable).Dispose(); }
I don't understand two things:
Why isn't
Dispose()
available?WcfChannelFactory<T>
derives fromChannelFactory<T>
, which derives fromChannelFactory
, which implementsIDisposable
. YetChannelFactory
doesn't have aDispose()
method. How is this possible?If I could (should?) simply call
Close()
on_channelFactory
, why doesn't the XML documentation state thatClose()
will also callDispose()
? Maybe it won't? This is confusing.