I have an issue in my code which is :
i have 2 classes Parent and Child
- class Parent
- {
- List<Child> Childs1 = new List<Child>();
- List<Child> Childs2 = new List<Child>();
- Parent()
- {
-
- }
- ~Parent()
- {
- Console.WriteLine("Hello World!!");
- }
- }
-
- class Child
- {
-
- }
// Output :-
Hello World!!
Hello World!!
- Why the parent distructor is been called twice when instantiated in the main after the program is closed?