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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:08:41+00:00 2026-05-28T03:08:41+00:00

Anybody know why this is not possible? If the event is just a MulticastDelegate

  • 0

Anybody know why this is not possible?
If the event is just a MulticastDelegate instance you should be able to reference it in the code. the compiler says EventA can only be on left side of -= or +=.

public delegate void MyDelegate();
public event MyDelegate EventA;

public void addHandlerToEvent(MulticastDelegate md,Delegate d){
 md+=d;

}

///
addHandlerToEvent(EventA,new MyDelegate(delegate(){}));
  • 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-28T03:08:41+00:00Added an answer on May 28, 2026 at 3:08 am

    An event is not a multicast delegate, just like a property is not a field.

    C#’s event syntax wraps multicast delegates to make life easier by providing syntactic sugar for adding and removing handler delegates. Your event definition would be compiled to the following:

    private MyDelegate _EventA;
    
    public event MyDelegate EventA
    {
        [MethodImpl(MethodImplOptions.Synchronized)]
        add 
        { 
            _EventA = (MyDelegate)Delegate.Combine(_EventA, value);
        }
    
        [MethodImpl(MethodImplOptions.Synchronized)]
        remove 
        { 
            _EventA = (MyDelegate)Delegate.Remove(_EventA, value);
        }
    }
    

    The add and remove methods within the expanded event definition are then called when you use operator += and operator -= on the event.

    This is done in order to hide the internals of the multicast delegate, but expose a simple way to implement publishing/subscribing to events. Being able to get the underlying delegate (outside of the class where it’s defined) would break that intentional encapsulation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know why the same code from this page http://emacsformacosx.com/ would not render
In Oracle, this returns 03/01/2010. That does not make sense to me. Anybody know
Does anybody know how impersonation should be configured or if it is even possible
Anybody know how to produce an xml element like this in rails using xml
Does anybody know why I get this warning when I turn off the auto-commit
Does anybody know how to do this syntax below in mysql? Without Stored Procedure,
Anybody know how to get gmail's OpenID working? All I find is this http://openid-provider.appspot.com/
Does anybody know whether one exists? I've been googling this for monthes... Thanks
I found some information about this on Scott Hanselmans Blog Does anybody exactly know
Is it possible to figure out just which type of event triggered $(window).unload(); ?

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.