Implementing 2 Interfaces with 'Same Name' Properties

后端 未结 8 1783
天涯浪人
天涯浪人 2021-01-04 22:50

This seems like a reasonable (and maybe simple?) scenario, but how would you do the following:

Lets say I have 2 interfaces:

Interface ISimpleInterfa         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 23:23

    Sorry but I don't master VB.Net syntax.

    In C# you can implement interfaces implicitly or explicitly. If your class Foo implements ErrorMsg as a public method, this implementation will be used for both interface.

    If you want distinct implementation you can implement it explicitly :

    string ISimpleInterface.ErrorMsg {get { ... } } 
    string IExtendedInterface.ErrorMsg {get { ... } set { ... }} 
    

提交回复
热议问题