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 6938733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:31:47+00:00 2026-05-27T12:31:47+00:00

I have public delegate void AdministrationEventHandler(object sender, AdministrationEventArgs e); public static event AdministrationEventHandler MainAdministrationEventHandler;

  • 0

I have

public delegate void AdministrationEventHandler(object sender, AdministrationEventArgs e);
public static event AdministrationEventHandler MainAdministrationEventHandler;

It’s main event handler in my wcf service.
I have also

private void MyEventHandler(object sender, AdministrationEventArgs e)
{
//code
}

I add new element

AdministrationEventHandler userToAddEventHandler = new AdministrationEventHandler(MyEventHandler);

and then

MainAdministrationEventHandler += userToAddEventHandler;

In my Broadcast() method I call MyEventHandler to each handler.
I’d like to call Broadcast() according to the AdministrationEventArgs e argument.

I tried to make something like list of MainAdministrationEventHandler and call Broadcast() for appropiate element of this list, but it doesn’t work.

I’m getting all handlers by MainAdministrationEventHandler.GetInvocationList()

Is it possible to check e argument after getting it in GetInvocationList()?

Or how can I in other way call Broadcast() to suitable handlers?

  • 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-05-27T12:31:48+00:00Added an answer on May 27, 2026 at 12:31 pm

    What’s a suitable handler? Because based on your code you can only assign handlers of type AdministrationEventHandler to that event.

    Also, the list returned from GetInvocationList() only contains the handlers to invoke. They haven’t been invoked yet this time around, and you need to invoke them and pass e to them.

    Something like this should do:

    AdministrationEventArgs args = new AdministrationEventArgs();
    Delegate[] dels = MainAdministrationEventHandler.GetInvocationList();
    if (dels != null)
        foreach (Delegate handler in dels)
            handler.Invoke(this, args);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have code segment namespace Test { public delegate void StaticticsDelegate(object sender,EventArgs e);
I have abstract class public abstract class BaseClass { public delegate void ContextMenuClickHandler(object sender,
I have declared a generic event handler public delegate void EventHandler(); to which I
I have public delegate void DocumentCompleteEventHandler(object pDisp, ref object URL) Can i use lambda
I have an event Load public delegate void OnLoad(int i); public event OnLoad Load;
i want to create public delegate void ValueChangedHandler(int value); public delegate void ValueChangedHandler(Object sender,
I have a base user control (inherited from System.Web.UI.UserControl ) public delegate void MyEventHandler(object
I have a Class similar to the following: public delegate void FanChangedEventHandler(Fan sender, EventArgs
I have progress form which delegate: // in ProgressForm thread public delegate void executeMethod(object
When i have delegate like public delegate void PrintMe(); (1) PrintMe a = delegate()

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.