Tech Off Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

C# in VS2003... Auto-Implementation for Interfaces

Back to Forum: Tech Off
  • User profile image
    W3bbo

    'lo

    In VB, if you want to implement an interface, you just type out "Implements IFoo" and after pressing "Return" it neatly inserts the stub methods and properties, as specified by the Inteface.

    ...but in C# I can't get the IDE to do this, what's more there's no easy-to-read list of all the members that aren't implemented.

    Is there something I'm missing or do I need to type them out manually?

    Thanks

  • User profile image
    Simo

    You can do it from the Class View window once you've indicated which interface you're implementing.

    Expand 'Bases and interfaces' node, right-click your interface and select Add.

  • User profile image
    Skeeterbug

    public MyClass : IFoo{space} [HIT TAB AND IT WILL INSERT STUB METHODS]

    The IDE does say "Press tab to insert stub members of IFoo Interface" but it's pretty hidden.

  • User profile image
    PerfectPhase

    Or use the smart tag that appears once you have completed the name of the interface.  Would be nice if it could generate constructor stubs this way as well.

    Stephen

  • User profile image
    W3bbo

    PerfectPhase wrote:
    Or use the smart tag that appears once you have completed the name of the interface.  Would be nice if it could generate constructor stubs this way as well.


    That's a VS2005 feature.

  • User profile image
    PerfectPhase

    Ahh, just read the message, not the title Smiley

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.