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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:38:21+00:00 2026-05-10T16:38:21+00:00

In Visual Studio, when I type the line Implements IDisposable , the IDE automatically

  • 0

In Visual Studio, when I type the line ‘Implements IDisposable‘, the IDE automatically adds:

  • a disposedValue member variable
  • a Sub Dispose() Implements IDisposable.Dispose
  • a Sub Dispose(ByVal disposing As Boolean)

The Dispose() should be left alone, and the clean up code should be put in Dispose(disposing).

However the Dispose Finalize Pattern says you should also override Sub Finalize() to call Dispose(False). Why doesn’t the IDE also add this? Must I add it myself, or is it somehow called implicitly?

EDIT: Any idea why the IDE automatically adds 80% of the required stuff but leaves out the Finalize method? Isn’t the whole point of this kind of feature to help you not forget these things?

EDIT2: Thank you all for your excellent answers, this now makes perfect sense!

  • 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-10T16:38:22+00:00Added an answer on May 10, 2026 at 4:38 pm

    If you actually are holding non-managed resources that will not be automatically cleaned up by the garbage collector and cleaning those up in your Dispose(), then yes, you should do the same in Finalize().

    If you’re implementing IDisposable for some other reason, implementing Finalize() isn’t required.

    The basic question is this: If Dispose() wasn’t called and your object garbage collected, would memory leak? If yes, implement Finalize. If no, you don’t need to. Also, avoid implementing Finalize ‘just because it’s safer’. Objects with custom finalizers can potentially need two GC passes to free them — once to put them on the pending finalizers queue, and a second pass to actually free their memory.

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

Sidebar

Ask A Question

Stats

  • Questions 102k
  • Answers 102k
  • 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 Rather than online, as mentioned in the above answer, grab… May 11, 2026 at 8:12 pm
  • Editorial Team
    Editorial Team added an answer Your comparer looks wrong to me. You're still just sorting… May 11, 2026 at 8:12 pm
  • Editorial Team
    Editorial Team added an answer You can do it all in one hit with preg_replace_callback… May 11, 2026 at 8:12 pm

Related Questions

I've come up against the unlikely scenario when I reference two external assemblies that
I was wondering if the type of javascript errors can be grouped into different
I'm trying to use the Oracle ODP.NET 11g (11.1.0.6.20) Instant Client on my ASP.net
I would like Visual Studio to break when a handled exception happens (i.e. I

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.