Method hiding in C # classes

I am looking at the implementation of a class LinkedListin C # and I cannot understand how the Add Method is hidden.

LinkedListimplements ICollectionwhich method has Add. In class code, a LinkedListmethod is Adddeclared as:

void ICollection<T>.Add(T value);

How can one have an internal method declared in an interface?

+3
source share
1 answer

The interface is implemented explicitly.

Interface elements implemented using Explicilty can only be accessed through an instance of the implemented interface, for example:

LinkedList list;
((ICollection)list).Add(...)

Check out this SO question and answer for more info: implicit vs explicit interface implementation

+6
source

All Articles