Destructor is never called.

JerryM 1,106 Reputation points
2022-04-15T09:38:02.43+00:00

Hello, can someone help me why the destructor ~Convert() is never called ?

using System;

namespace App
{

    class Program
    {
        static void Main(string[] args)
        {
            Program.Start();
        }// static void Main(string[] args)

        public static void Start()
        {
            Convert c = new Convert();
            c.Read();
            c = null;
        }// public static void Start()

    }// internal class Program

    class Convert
    {
        public Convert() 
        {
            Console.WriteLine("Constructor Convert");
        }// public Convert()

        ~Convert()
        {
            Console.WriteLine("Destructor Convert");
            Console.Beep();
        }// ~Convert

        public void Read() 
        {

        }// public void Read() 

    }// class Convert

}// namespace App
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,929 questions
0 comments No comments
{count} votes