Answer the question
In order to leave comments, you need to log in
How to call a destructor?
Here is the code, how do I call the destructor?
class Program
{
static void Main(string[] args)
{
Program f = new Program();
}
public Program()
{
Console.WriteLine("Конструктор");
}
~Program()
{
Console.WriteLine("Деструктор");
}
}
Answer the question
In order to leave comments, you need to log in
no need to manually call the destructor, it will be called when the GC releases resources.
Implement IDisposable. Well, or pull GC.Collect()
https://docs.microsoft.com/ru-ru/dotnet/api/system...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question