1
Reply

Given class is using IDisposable interface. When static object test will subject to garbage collectionclass Class1:IDisposable{static object test = null;static void main(string[] args){class1 cv = new class1();cv.dispose();test = null;console.readline();} }

Manju lata Yadav

Manju lata Yadav

10y
1.3k
0
Reply

    test object is global for Class1. so it will be in scope till the program end and it will holding its place in stack whereas it is not pointing anything in Heap. so it will be available for garbage collection once the program ends. As Garbage Collection only collect unreferenced memory.