Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How does "Implement interface through <field>" work?

I’m wondering how the "Implement interface through [field]" thing works with Intellisense, is it something that’s just hard-coded into Intellisense for specific interfaces, or is it done dynamically? If so, is there a way I can get it to do the same thing with my own interfaces?

Note: I looked through many similar questions, and I think that by now it’s safe to assume that nobody has asked the question I’m trying to ask. I also cannot think of any ways to make it any less ambiguous.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

That feature is pretty straightforward. If you have a class that meets these criteria:

  • claims to implement an interface
  • isn’t implementing the members required by that interface
  • has a field or a property which does implement that interface

… then this code analysis recommendation will allow you to create implementations for the missing members which simply pass through to the same members on the given field or property.

You can absolutely make it work on your own interface, by meeting the aforementioned criteria.

before

after

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading