'C# DataGridViewSelectedCellCollection can't implicitly cast to IList

Observations:

  1. DataGridViewSelectedCellCollection implements IList, ICollection, and IEnumerable.
  2. DataGridViewSelectedCellCollection does not have all the functions in its API to implement all of these interfaces (e.g. it's missing IList.Add

Question:

  1. How can DataGridViewSelectedCellCollection not implement all the functions in the interface?
  2. Why can't the compiler implicitly cast to the interface (or at least provide details in the compiler message that there's ambiguity)?

Example:
Where selected is DataGridViewSelectedCellCollection and cell is DataGridViewCell

This doesn't compile: selected.Add(cell); But this does: ((IList)selected).Add(cell);

Sources:
DataGridViewSelectedCellCollection docs



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source