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

  • Home
  • SEARCH
  • 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 7618713
In Process

The Archive Base Latest Questions

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

I have never used ‘add’ and ‘remove’ when creating and using events in .NET.

  • 0

I have never used ‘add’ and ‘remove’ when creating and using events in .NET. Have a look at the code below:

public event EventHandler InitComplete
    {
        add
        {
            base.Events.AddHandler(EventInitComplete, value);
        }
        remove
        {
            base.Events.RemoveHandler(EventInitComplete, value);
        }
    }

I realise this is a very simple question, but where is ‘value’ declared? Can anyone recommend a good tutorial on use of add and remove. I have read through a few but am still not wise enough.

  • 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-31T03:28:39+00:00Added an answer on May 31, 2026 at 3:28 am

    value is “whatever handler is being subscribed or unsubscribed”. So you can think of:

    button.Click += HandleClick;
    

    as being similar to:

    button.add_Click(new EventHandler(HandleClick));
    

    In that respect, an event is just like a property:

    private string foo;
    public string Foo
    {
        get { return foo; }
        set { foo = value; }
    }
    

    … except that with events you have add and remove instead of get and set.

    See my article on events and delegates for some more information – or section 10.8 of the C# 4 language specification for the details.

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

Sidebar

Related Questions

I have never used namespaces for my code before. (Other than for using STL
I have never used Try-catch in my code before, but now I need to
I am new ASP.NET and I have never used a GridView or DataGrid, but
I have never used enums before i have a problem while creating enums i
I have never used threads--never thought my code would benefit. However, I think threading
I have never used octal numbers in my code nor come across any code
I have never used nullable types in my C# code. Now I have decided
I just started using PyGI (on Ubuntu Natty), although I have never used pygtk
I want a multiline text area using VB.net. I have used a text area
I have never used a SortedDictionary and was just curious if when you add

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.