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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:48:49+00:00 2026-05-26T10:48:49+00:00

As I understand an Event is a way for a class to allow clients

  • 0

As I understand an Event is a way for a class to allow clients to give it delegates to methods that should be called when the event occurs. When the event occurs, the delegate(s) given to it by its clients are invoked.

But as demonstrated in following code above said functionality can also be achieved by delegate only i.e. without using delegate.

class Program
{
    static void Main(string[] args)
    {
        ListWithChangedEvent lwce = new ListWithChangedEvent();
        lwce.delegateVariable = DelegateTestMethod;
        lwce.Add("test");

        Console.ReadLine();
    }

    public static void DelegateTestMethod(object sender, object e)
    {

    }
}

public delegate void ChangedEventHandler(object sender, object e);

public class ListWithChangedEvent : System.Collections.ArrayList
{
    public override int Add(object value)
    {
        int result = base.Add(value);
        if (delegateVariable != null)
            delegateVariable(this, "");
        return result;
    }

    public ChangedEventHandler delegateVariable;

}

So, I was wondering what additional functionality does Events provide?

  • 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-26T10:48:49+00:00Added an answer on May 26, 2026 at 10:48 am

    So, I was wondering what additional functionality does Events provide?

    Events provide two distinctly different advantages over exposing a public delegate:

    1. You’re making the intent very clear. A delegate is typically exposed publically for a very different purpose than an “event” – by using an event, you’re very clearly saying “this is something that will get raised at a specific point”. Exposing a delegate typically has a different meaning – most often a delegate in a public API is a required input for that API – ie: something that is used directly by the method, not an optional notification mechanism triggered by the method.
    2. Events, technically, are not necessarily just a delegate. An event actually has the option of allowing custom add and remove accessors, which allow you to manually determine what happens when a subscriber subscribes or unsubscribes from the event. For example, many implementations of ICommand.CanExecuteChanged actually don’t include their own delegate at all – but silently route to the CommandManager’s RequerySuggested event.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that one can raise an event in the class that the implementation
Is there a way to have mutable function arguments in F#, that would allow
I have been trying to understand the way ActionScript's events are implemented, but I'm
I'm trying to understand the event system of Kohana. The only thing i don't
I know what thread means and if I understand the event dispatching thread (EDT)
As far as I understand, the onchange event of a text input element is
I'm trying to understand why $('#title').replaceWith('ha'); will work outside the drop: function(event, ui) {}
I don't understand the rationale of this code, taken from javax.swing.event.EventListenerList docs: protected void
I understand that interfaces are contracts and any changes (even additions) break any dependent
I am trying to implement the event aggregator pattern in a simple way to

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.