简体   繁体   中英

Interface implementing it's own method

We recently came across an interface that looks similar to this in our solution. When we upgraded to VS 2015 it caused build issues. We believe the code is safe to remove, but want to be sure nobody else could think of why this would be valid code, or unsafe code to change (We would remove the implements on all of these)?

Public Interface IMyInterface
    Property p1 as string Implements IMyInterface.p1
    Property p2 as string Implements IMyInterface.p2
    Property p3 as string Implements IMyInterface.p3
    Property p4 as string Implements IMyInterface.p4
    .
    .
    .
End Interface

Just not sure why or how an interface method can implement a property on itself.

The Visual Basic reserved word Implements is used in two ways. The Implements statement signifies that a class or structure implements an interface. The Implements keyword signifies that a class member or structure member implements a specific interface member.

You should remove the Implements IMyInterface.p_ part of the property declarations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM