Describe ways of cleaning up objects.

Answer Posted / vinay tiwari

//we can perform this job with the help of destructor
using System;
class a
{
public int x;
public a(int b)
{
x=b;
}
public void display()
{
Console.WriteLine(x);
}
~a()
{
Console.Write("destroying object which is
created by a()");
}
}
class b
{
static void Main(string [] args)
{
a ob =new a(5);
ob.display();
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are object pooling and connection pooling and difference between them?

516


Is it good to use var in c#?

465


What is windows forms in c#?

472


What is ilist c#?

503


Why objects are stored in heap in c#?

481






what is partial assembly reference

509


What is ado c#?

535


What types of object can I throw as exceptions?

540


What is application object in c#?

506


What is a string c#?

491


How can I get around scope problems in a try/catch?

479


2. What happened when BO object has been called?

1535


What does f mean in c#?

515


What is a Assembly?

544


If c# destructors are so different to c++ destructors, why did ms use the same syntax?

498