Interviews - C# Corner

Manju lata Yadav
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();} }
By Manju lata Yadav in .NET onJul 01 2014
  • Diwakar Sharma
    Jul, 2014 15

    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.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS