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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:05:35+00:00 2026-05-27T16:05:35+00:00

Whenever I call GC.SupressFinalizer() in the Dispose method, should I assign null to all

  • 0

Whenever I call GC.SupressFinalizer() in the Dispose method,
should I assign null to all instance members to have them cleaned up, or they would be removed in any case ?

For example:

class test : IDisposable
{ 
    public int a = 10;
    public int b = 20;
    public int c = 39;

    private bool is_disposed = false;

    Dispose(bool shall_dispose)
    {
        if(!is_disposed && shall_dispose)
        {
            is_disposed = true;

            // shall I annulate a, b & c or they will be freed anyway??
            // a = null; ?, integers aint nullable 
            // b = null; ?
            // c = null; ?

            // or primitive types should't be annulated? only reference(heap) types?
        }
    }

    Dispose()
    {
        Dispose(true);
    }

    ~test()
    {
        Dispose(false);
    }
}
  • 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-27T16:05:36+00:00Added an answer on May 27, 2026 at 4:05 pm

    GC.SupressFinalizer() will not stop your object from being collected when it is no longer reachable, it will just supress the call to the object’s finalizer. So both your object and its members will be collected, no matter wether you assign null or not.

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

Sidebar

Related Questions

I'm working on a Perl module and whenever I call the skip() method I
Dumb question, but whenever you call new, do you always have a pointer? SomeClass
I'm using the facebook graph PHP sdk - whenever I call the $facebook->api method
I have this very annoying issue, whenever i call a function: void renderGame::renderMovingBlock(movingBlock* blockToRender){
Suppose i have one simple function in my program. Whenever i call that function
I have a simple recursive method, a depth first search. On each call, it
I have a java Script function that i want to call whenever mouse moves
I have a photo selection model, but for some reason whenever I call the
I have an object pool, and I need to call a delegate method OnFree(),
Whenever I call this method in the Android emulator: SensorManager sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); The

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.