I have a class with this field:
private WcfChannelFactory<IPrestoService> _channelFactory;
In the Dispose() method, I do this:
if (_channelFactory != null) { _channelFactory.Dispose(); }
But this causes an error:
Unable to access explicit implementation of IDisposable.Dispose
After doing the research, it turns out that I can dispose of as follows:
if (_channelFactory != null) { (_channelFactory as IDisposable).Dispose(); }
I do not understand two things:
Why not Dispose() ? WcfChannelFactory<T> comes from ChannelFactory<T> , which comes from ChannelFactory , which implements IDisposable . However, ChannelFactory does not have a Dispose() method. How is this possible?
If I could (should?) Just call Close() on _channelFactory , why isn't the XML documentation saying Close() also calls Dispose() ? Maybe this is not so? This is confusing.
source share