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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:02:49+00:00 2026-06-07T22:02:49+00:00

Since my first lessons about C# classes I’ve learned that not only I cannot

  • 0

Since my first lessons about C# classes I’ve learned that not only I cannot invoke the Finalize() method of a class explicitly(it is called by the Garbage Collector), but I’m not even allowed to implement it in my custom classes.
The thing that makes me a bit confused is that in MSDN like here –

By default, the Object.Finalize method does nothing. If you want the garbage collector to perform cleanup operations on your object before it reclaims the object's memory, you must override this method in your class.

I’ve found numerous places that suggest something else. Can anyone clarify why is that?

  • 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-07T22:02:52+00:00Added an answer on June 7, 2026 at 10:02 pm

    In the same MSDN page you can read:

    You cannot override the Finalize method in the C# or C++ programming languages. In C#, use destructor syntax to implement the Finalize method. In version 2.0 of the .NET Framework, C++ provides its own syntax for implementing the Finalize method, as described in Destructors and Finalizers in Visual C++. In earlier versions, C++ used destructor syntax for the Finalize method, as C# does.

    It means that the Finalize() method is what will be called by the Garbage Collector but it’s hidden by the friendly syntax of destructors. What you’ll write as ClassName.~ClassName() will be rewritten as ClassName.Finalize() by the compiler.

    EDIT
    To make the point clear this is the actual syntax to implement the finalizer in C#:

    class MyClass
    {
        ~MyClass()
        {
        }
    }
    

    Usually you do not even need to implement your finalizer method (and it can even hurts performance) but you’ll implement the Dispose pattern.

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

Sidebar

Related Questions

I've been intrigued by all the android world since I first learned about it
I can select the first item in the div using $('.class:first') Now since I
I've been using EF4 (not code-first) since a year, so I'm not really an
i have a question about this code. class Queue { Node first, last void
I've been scratching my head since my first VHDL class and decided to post
I've been a user of UltraCompare Pro since it first came out, and I
Since C# doesn't have a before,after,last,first etc. as part of its foreach. The challenge
Since the standard c# convention is to capitalize the first letter of public properties,
My first question and Im excited... I've lurked since go-live and love the site,
First, thanks for the StackOverflow team, cause it's a very useful website, since i'm

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.