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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:37:03+00:00 2026-06-08T18:37:03+00:00

I am attempting to subscribe two events to an object. But the object is

  • 0

I am attempting to subscribe two events to an object. But the object is not instantiated before I try to add the events. Is there a way I can subscribe these two events and instantiate afterwards? I already have the delegates, event, event args and event handler working.

Sample Code:

Ares a;

public B()
{
    a.up += new upEventHandler(doUp);
    a.down += new downEventHandler(doDown);
    a = new Ares();
}
  • 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-08T18:37:05+00:00Added an answer on June 8, 2026 at 6:37 pm

    I am attempting to subscribe two events to an object. But the object is not instantiated before I try to add the events. Is there a way I can subscribe these two events and instantiate afterwards?

    No, absolutely not. It’s exactly like trying to set properties on an object before the object exists. Try to think about how that would work – and then realize that subscribed event handlers are part of the state of an object just like properties are.

    Obviously you could store the event handlers somewhere else and subscribe them later on, but as stated, the answer is simply no. It doesn’t make any sense at a conceptual level, or a practical one.

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

Sidebar

Related Questions

Attempting to pull from git repo, but getting the following output. I think these
I have a feature I'm attempting to implement using NServiceBus but not sure the
Attempting to set up an automated texting service for customers, where people can text
Attempting to deserialize JSON data and update each object's prototype and inherit a common
I am attempting to add a simple Blowfish password encoder to Symfony2. When a
I'm attempting to use Reactive Extensions (Rx) to subscribe to WebClient.DownloadProgressChanged . As far
Attempting to recursively add XElements stepping through a category list. XElement dataResponse = new
I'm attempting to add a subscription to Google Reader, using it's API, however I'm
Attempting to render a model object into a JSON structure via a partial, like
I am attempting to add an event listener to a custom product so that

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.