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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of delegates in c#?

830


Which are the loop types available in c#?

892


what are windows services?

936


What is a must for multitasking

924


How many aware interfaces are there?

847


Define acid rule of thumb for transactions in c#.

846


How do you declare an interface in c#?

861


Can we create extension method for interface?

845


What is dictionary collection in c#?

842


What are the extension methods in c#?

858


Why do we use struct in c#?

910


How many types of constructors are there in c#?

900


What is the difference between an application domain and a process?

938


What are the collection types can be used in c#?

825


What is the main method in c#?

990