>
 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
    ON THIS PAGE
    SEARCH
    CATEGORIES
    ARCHIVES
    BLOGROLL

Designed by NUKEATION STUDIOS