You can think about it, since each implemented interface has its own virtual method table.
However, Dictionary.Add not virtual; you cannot invoke an inheritance implementation:
Dictionary<string, string> d = new InheritedDict<string, string>();
But:
public class InheritedDict : Dictionary<string, string> { void IDictionary<string, string>.Add(string key, string value) { base.Add(key, value); } } Dictionary<string, string> d = new InheritedDict<string, string>(); var d2 = d as IDictionary<string, string>; d2.Add("foo", "bar");
The second way is complicated, right?
Therefore, it is better to implement the entire IDictionary interface instead of overriding a single Dictionary method. Therefore, although solution A is a bit detailed, it is absolutely correct.
source share