In C#, is it possible to implement an interface member using a member with a different name, like you can do in VB.NET?

前端 未结 2 1466
南笙
南笙 2021-02-19 11:38

Ok, this is a question I\'m asking, not as in demonstrating good coding practices (this actually could be considered a bad practice) but rather in regards to \'can\' it be done

相关标签:
2条回答
  • 2021-02-19 11:39

    It "can" be done in the sense that you can achieve a result that's basically indistinguishable from the VB scenario by using explicit implementation + a public method that calls that implementation.

    Aside from cases involving reflection, this really will end up being the same thing.

    0 讨论(0)
  • 2021-02-19 11:40

    No, this isn't possible in C#. (You can't "explicitly implement an interface" in VB.NET either.)

    0 讨论(0)
提交回复
热议问题