Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How u call destructor and dispose methode in c#.NET



How u call destructor and dispose methode in c#.NET..

Answer / ruchika mathur

Destructor: They are special methods that contain the
cleanup code for the object.You cannot call them explicitly
as they are called by GC implicitly.
Class MyClass
{
~MyClass()
{
}
}

public interface IDisposable
{
void Dispose();
}
Class Test:IDisposable
{
protected void Dispose()
{
if(disposing)
{
// Code to dispose the managed resources of the class
}
// Code to dispose the un-managed resources of the class

isDisposed = true;
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}


}
}

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Sharp Interview Questions

How To Maintain Transaction In C#?

1 Answers   Phoenix Technologies,


What is static classes?

0 Answers  


What is difference between Convert.ToString(variable) and variable.ToString()

4 Answers   Mascon,


Can abstract class be sealed?

0 Answers  


Define Abstract Class in C#

0 Answers   HCL,


How long can a string be c#?

0 Answers  


What is a value type in c#?

0 Answers  


Why do we use anonymous method in c#?

0 Answers  


What is an array? Give the syntax for a single and multi-dimensional array?

0 Answers  


What is the difference between ienumerable and enumerable?

0 Answers  


Can we set image Source dynamically using C# in WPF application?

0 Answers   Tech Mahindra,


Can you change the value of a variable while debugging a C# application?

1 Answers   Siebel Systems, Wipro,


Categories