What is the best way to match a specific member implementation (on a class) with the corresponding member of an interface? #907
-
This isn't an issue for assemblies created from C# because the class member names must match the names of the interface members. However, in Visual Basic, the names of the members can be different to the names of the interface members that they implement. For example, I have an interface defined in VB like so:
I can implement this interface on my VB class like so:
When the code is compiled, this causes a mismatch between the Name of the PropertyDefinition found on the SimpleVBClass ("AlternativeNamedProperty") and the Name of the PropertyDefinition found on the ISimpleInterface. My aim is to be able to unequivocally match a member implementation with the "contract" that it fulfills. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Look at the generated IL:
The property getter and setter are methods with an explicit Note that no By the way:
C# has explicit interface implementations, which produce similar IL. |
Beta Was this translation helpful? Give feedback.
Look at the generated IL:
The property getter and setter are methods with an explicit
.override
clause. You'll find those in theMethodDefinition.Overrides
collection.Note that no
.override
clause needs to be present when the method signatures match (implicit implementation).By the way:
C# has explicit interface implementations, which produce simil…