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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:33:05+00:00 2026-05-12T20:33:05+00:00

can anyone explain to me what is happening when a instance of a class

  • 0

can anyone explain to me what is happening when a instance of a class declaring a static eventhandler will hold reference to other classes that have registered intent with the event handler in question, being that they are all static would there be any contention between users sessions(I mean his/her usage of the system in a point in time) in asp.net

heres an example , extract from BlogEngine.Net

Post.Saved += new EventHandler<SavedEventArgs>(Post_Saved);

Saved is static to the class post, this event is consumed all over the show, would another user’s session see the post saved event since it is static? what are the threading issues I should be aware of when declaring static events?

  • 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-12T20:33:05+00:00Added an answer on May 12, 2026 at 8:33 pm

    When multiple event handlers are registered for an event they are (as far as I know) run sequentially (in the order they were attached), not simultaneously. So there shouldn’t be any concurrency issues.

    If the event is static then yes, all user sessions will see it as they’re run in the same .NET AppDomain. (I presume by “session” you mean an ASP.NET session.)

    The main thing to watch out for with static events is memory leaks. If your event handler is an instance method and you attach it to a static event then that static event now has a reference to the object on which the handler is declared, so that object and anything it references will remain in memory until either the event handler is detached or the whole AppDomain the code is running in is unloaded. Because of this you have to be careful to either detach the event handler when it’s no longer needed or at least make sure your event handling class doesn’t reference anything else, so the memory leak is minimal.

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

Sidebar

Related Questions

can anyone explain whats happening here. I was under the impression that an array's
for i=0:255 m(i+1)=sum((0:i)'.*p(1:i+1)); end What is happening can anyone explain. p is an array
Can anyone explain why here a = [] ? 1 : 2 a will
Can anyone explain, if Struts Action classes are threadsafe in Struts 1.x. Does RequestProcessor
Can anyone explain why the following is happening: When we serialize a file in
Can anyone explain why this is happening? ie. Even when 175 is present in
Can anyone explain to me why this is happening? get :robots response.should render_template(no_index) response.body.should
Can anyone explain what is happening with the following SQL? I understand order by
Can anyone explain to me why this program: for(float i = -1; i <
Can anyone explain me how to overpass these problems? Description Resource Path Location Type

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.