问题:
What are the differences in implementing interfaces implicitly and explicitly in C#? 在C#中隐式和显式实现接口有何区别?
When should you use implicit and when should you use explicit? 什么时候应该使用隐式,什么时候应该使用显式?
Are there any pros and/or cons to one or the other? 彼此之间是否有优点和/或缺点?
Microsoft's official guidelines (from first edition Framework Design Guidelines ) states that using explicit implementations are not recommended , since it gives the code unexpected behaviour. Microsoft的官方指南(来自第一版Framework Design Guidelines )指出, 不建议使用显式实现 ,因为它会给代码带来意想不到的行为。
I think this guideline is very valid in a pre-IoC-time , when you don't pass things around as interfaces. 我认为,在您未将事物作为接口传递时 ,该指南在IoC之前非常有效 。
Could anyone touch on that aspect as well? 任何人都可以谈谈这方面吗?
解决方案:
参考一: https://stackoom.com/question/bIz/C-接口-隐式实现与显式实现参考二: https://oldbug.net/q/bIz/C-Interfaces-Implicit-implementation-versus-Explicit-implementation
来源:oschina
链接:https://my.oschina.net/u/4437974/blog/4375104