Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 696
Dan Drews Avatar asked May 15 '26 15:05

Dan Drews


1 Answers

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.

like image 189
egarlock Avatar answered May 18 '26 12:05

egarlock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!