Q:

ConcurrentDictionary and IDictionary

I noticed that ConcurrentDictionary implements the IDictionary interface, yet despite that the interface supports Add, ConcurrentDictionary doesn't have that function.  How does this work?  I thought interfaces imposed functionality on the implementing classes...

A:

It is using explicit interface implementation. Here is an example.
interface IFoo
{
   void Foo();
}

class FooImplementation : IFoo
{
   void IFoo.Foo()
   {
   }
}

If you assign or cast a ConcurrentDictionary to IDictionary, you can use all the methods defined there.

