4
Answers

Releases the managed resources in c#

Ken H

Ken H

10y
3.7k
1
Hello friend,
      How to determine whether the object is recovered?
 
 class Program{
static void Main(string[] args){

Student student = null;

using (student = new Student())
{
Console.WriteLine("student is null:{0}\n",student == null);

}

Console.WriteLine("student is null:{0}\n",student == null);
}
}

public class Student : IDisposable
{

public Student() { }

~Student()
{
Console.WriteLine("Start Execute Destructor...\n");
}

public void Dispose(){

Console.WriteLine("Start Execute Dispose...\n");

}

}
 
Thanks.
 
Answers (4)