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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:18:57+00:00 2026-06-15T01:18:57+00:00

I read the excellent answer explaining how to use the Dispose pattern, and also

  • 0

I read the excellent answer explaining how to use the Dispose pattern, and also why it works that way.

Proper use of the IDisposable interface

The post clearly states that you would want to use the Dispose pattern in two different scenarios:

  1. get rid of unmanaged resources (because we have to)
  2. get rid of managed resources (because we want to be helpful)

My question is:

  • When an object is subscribed to an external event for its entire lifetime, is it also common/good practice to unregister from that event in the Dispose method? Would you implement the IDisposable interface for that purpose?
  • 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-15T01:18:59+00:00Added an answer on June 15, 2026 at 1:18 am

    Yes, you should.

    This is the best way to indicate to consumers of your class that it has “resources” that must be released. (even though event subscriptions are technically not resources)

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

Sidebar

Related Questions

I've just read the accepted excellent answer to this question that clarifies the conceptual
I just read an excellent post, Portable Fixed-Width Integers in C , everything makes
I read a while back this excellent answer by @Bill Karwin: https://stackoverflow.com/a/1313293/317889 This pretty
I read this Sorting an array of JavaScript objects excellent post on how to
I've read an excellent article on MSDN regarding Generics in C#. The question that
I've read through the other excellent stack overflow articles and tried a lot of
I read this question in stackoverflow. The excerpt answer provided by bbum is below:
I have read the (excellent) documentation but I can't figure out how to do
I have a read a number of excellent questions and answers today about dealing
I read this excellent article and it make sense: Java is strictly pass by

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.