C# - What is the reason for “Explicitly implemented interface members are always implicitly private ?”

后端 未结 3 1896
执笔经年
执笔经年 2020-12-11 17:42

When i need to implement the interface member explicitly ,it is private.

for example :

 // when explicit implementation it is always private
  void I         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 18:23

    Because 2 interfaces that implemented by that class explicitly can have method with the same name. That is why that method is private when accessing by class reference and public when interface.

提交回复
热议问题