Explicit interface implementation in VB.NET

后端 未结 3 1995
时光取名叫无心
时光取名叫无心 2020-12-11 15:25

How to implement explicit interface implementation in VB.NET?

相关标签:
3条回答
  • 2020-12-11 16:05

    As others have said, make the routine private, and it forces clients to call through the interfaces.

    Just one more word. Explicit interface implementation in C# also allows the programmer to inherit two interfaces that share the same member names and give each interface member a separate implementation. In VB.Net, that's easy, because the implementing methods can have different names from the interface names.

    Function ICanUseAnyNameILike() As String Implements IFoo.Bar
    
    Function ItsTotalAnarchy() As String Implements IFoo2.Bar, IFoo3.ItsMadnessReally
    
    0 讨论(0)
  • put the method to private.

    0 讨论(0)
  • 2020-12-11 16:17

    Just declare sub/function Private:

    Private Function Bar() As String Implements IFoo.Bar
    
    0 讨论(0)
提交回复
热议问题