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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:37:11+00:00 2026-05-10T13:37:11+00:00

The .NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable,

  • 0

The .NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I’ve always done in the rare situations where a finalizer is warranted.

However, what happens if I just do this:

class Foo : IDisposable {      public void Dispose(){ CloseSomeHandle(); } } 

and don’t implement a finalizer, or anything. Will the framework call the Dispose method for me?

Yes I realise this sounds dumb, and all logic implies that it won’t, but I’ve always had 2 things at the back of my head which have made me unsure.

  1. Someone a few years ago once told me that it would in fact do this, and that person had a very solid track record of ‘knowing their stuff.’

  2. The compiler/framework does other ‘magic’ things depending on what interfaces you implement (eg: foreach, extension methods, serialization based on attributes, etc), so it makes sense that this might be ‘magic’ too.

While I’ve read a lot of stuff about it, and there’s been lots of things implied, I’ve never been able to find a definitive Yes or No answer to this question.

  • 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. 2026-05-10T13:37:12+00:00Added an answer on May 10, 2026 at 1:37 pm

    The .Net Garbage Collector calls the Object.Finalize method of an object on garbage collection. By default this does nothing and must be overidden if you want to free additional resources.

    Dispose is NOT automatically called and must be explicity called if resources are to be released, such as within a ‘using’ or ‘try finally’ block

    see http://msdn.microsoft.com/en-us/library/system.object.finalize.aspx for more information

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

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 117k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not ideal, but you could set the ObjectDatasource's Parameter DefaultValue… May 11, 2026 at 10:47 pm
  • Editorial Team
    Editorial Team added an answer If you use relative URIs in your stylesheet, you need… May 11, 2026 at 10:47 pm
  • Editorial Team
    Editorial Team added an answer SELECT * FROM table WHERE title LIKE '%' || ?… May 11, 2026 at 10:47 pm

Related Questions

Recently I needed to compare a suggested pattern for IDisposable and object finalization with
I know that boxing is a popular concept with plenty of information available on
I have a high-level goal of creating a static utility class that encapsulates the
In my application, I've got several ViewModels that have a single service (repository, DAO,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.