>
 Wednesday, July 28, 2004
« More on Services, Physical Tiers and Com... | Main | .NET Rocks Contest - Win a Tablet PC tha... »

Sometimes we take for granted that everyone knows the productivity tricks available to developers in Visual Studio .NET 2003. One of the coolest tricks provided through Class View is a built-in feature that will generate shell functions for any interface your class implements. Here’s how it works. Add a new class to a project, and create a class definition that includes the interface implementation list. In this example, I'm creating a new HTTP Module:

public class ErrorsGoHomeModule: IHttpModule

{

     public ErrorsGoHomeModule()

     {

     }

}

Then, go to Class View:

Right click on the interface, in this case, IHttpModule, and select Add/Implement Interface…

This generates the following code in my example:

     #region IHttpModule Members

 

     public void Init(HttpApplication context)

     {

        // TODO:  Add ErrorsGoHomeModule.Init implementation

     }

 

     public void Dispose()

     {

        // TODO:  Add ErrorsGoHomeModule.Dispose implementation

     }

    #endregion

Now you’re ready to implement required members!

7/28/2004 8:20 PM .NET  | Comments [4]  |  View reactions  |  Trackback
Wednesday, July 28, 2004 9:01:44 PM (GMT Standard Time, UTC+00:00)
You can also achieve this in code window. Simply hit the TAB key after ': IHttpModule' ... voila. Only works with VS.NET 2003, not 2002.
Wednesday, July 28, 2004 9:06:43 PM (GMT Standard Time, UTC+00:00)
Umm, I think you can even do that without having to navigate through class view. Once to type the interface name, VS will give you friendly message asking you to "Press Tab to implement stubs for interface "blah"' and tabbing would do the same thing that you have here.

:)

http://mysite.verizon.net/girishb/tabToImplement.JPG

is an image for such a thing.
Wednesday, August 04, 2004 1:29:35 PM (GMT Standard Time, UTC+00:00)
Add override is also nice on Base classes...to bad both are missing from the Whidbey Class View tool (which now has zero value).
Thursday, December 06, 2007 4:59:46 PM (GMT Standard Time, UTC+00:00)
pjwuky jgrezf jzgmup pbrvchn nupsf xaeznyod eqrwji
Name
E-mail
(will show your gravatar icon)
Home page

Comment (HTML not allowed)  

    ON THIS PAGE
    SEARCH
    CATEGORIES
    ARCHIVES
    BLOGROLL

Designed by NUKEATION STUDIOS