Home > database >  Visual Studio 2019 Automatic Event Handlers Generation
Visual Studio 2019 Automatic Event Handlers Generation

Time:01-25

Is it at all possible to generate handlers for ALL events object has to offer in a similar way you can do it for a single event simply by pressing tab tab after = ?

if not Visual Studio, any other IDE that can do that ?

CodePudding user response:

Yes I understand that. It's not what I am asking. I need I way to quickly generate these handlers.

CodePudding user response:

I have one way for you. Obviously, this solution will not meet your needs i 100%, but you can try it. You can create an interface with all methods from a known object and inherit it. Now you can implement this interface. Unfortunately, you need to add an event handler to the constructor.

class myObject:IMyObject {

    Public myObject() //this you have to add
    {
        this.my_Event  = onMy_EventHandled();
        this.my_Event1  = onMy_EventHandled1();
    }

    //this section will be create automatically        
    void onMy_EventHandled()
    {
    }
        
    void onMy_EventHandled2()
    {
    }
}

e.g. interface

interface IMyObject {
   void onMy_EventHandled();
   void onMy_EventHandled();
}
  •  Tags:  
  • Related