When using an explicit interface implementation, members are forced to use something more limited than private . And when the access modifier is forced, you can not add it.
Similarly, in the interface itself, all members are public . If you try to add a modifier inside the interface, you will get a similar error.
Why are explicit members (very) private? Consider:
interface I1 { void M(); } interface I2 { void M(); } class C : I1, I2 { void I1.M() { ... } void I2.M() { ... } } C c = new C(); cM();
If these methods were publicly available, you will have a name collision that cannot be resolved by normal overload rules.
For the same reason, you cannot even call M() from within a member of class C Before avoiding the same ambiguity, you will have to drop this on a specific interface.
class C : I1, I2 { ... void X() { M();
Henk Holterman Apr 19 '10 at 16:35 2010-04-19 16:35
source share