Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:39:11+00:00 2026-06-13T15:39:11+00:00

My current situation looks like this: I have these two delegates in a separate

  • 0

My current situation looks like this:

I have these two delegates in a separate file:

public delegate void EventHandler(Object obj, EventArgs e); 
public delegate void OtherEventHandler(Object obj, OtherEventArgs e); 

I have an Event class that look like this:

class Event {
   EventHandler _handler;
   public Event(EventHandler handler) {
      _handler = handler;
   }
}

I have another class that inherits Event this way:

class OtherEvent : Event {
   OtherEventHandler _handler;
   public OtherEvent (OtherEventHandler handler) : base(handler) {
      _handler = handler;
   }
}

This one is where the problem occurs. The error is with the part on base(handler). Because handler in OtherEvent is an OtherEventHandler, the base class cannot accept it; the base class only accepts EventHandler.

My intention is to have a “generic” delegate such that when OtherEvent inherits the methods from Event, OtherEvent still has the flexibility to use its own type of delegate with different parameters from its parent for the handler class field.

What can I do to achieve my intention?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:39:12+00:00Added an answer on June 13, 2026 at 3:39 pm

    Whats wrong with usage of default delegate EventHandler<TEventArgs>? It can be parametrized with any type, inherited from EventArgs.

    Also I don’t really understand purpose of Event class. You can define events simply this way:

    public event EventHandler<OtherEventArgs> OtherEvent;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current situation is: I have to read a file and put the contents
First, I'd like to describe my current situation. I have an RDLC whose data
I have an INSERT statement that looks like this: INSERT INTO officer (officer_number, name,
I have a double namespace situation, where my controllers look like this: CandidateController Candidate::PerformanceController
I've found what looks like a very simple solution to my current situation. My
Here's my current situation: I have a NSMutableArray named dictKeyArray which I assign a
Here is my current situation; I am a near complete regexp illiterate, and have
let me explain my current situation i have a SharePoint site lets say it
I have xml file in server. I am parsing this xml using DOM(xml is
I have some trouble trying to setup a template to solve address this situation:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.