How can TcpClient implement IDisposable and not have a public Dispose method?

.net, idisposable, tcpclient

Solution

By using explicit interface implementation. Instead of

public void Dispose()
{
    ...
}

it would have

void IDisposable.Dispose()
{
    ...
}

Various other types do this; sometimes it's out of necessity (e.g. supporting `IEnumerable.GetEnumerator` and `IEnumerable<T>.GetEnumerator`) and at other times it's to expose a more appropriate API when the concrete type is known.

Problem

Just as the title says: How can TcpClient implement IDisposable and not have a public Dispose method?

Original source