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 difference between dynamic and var in c#?

930


What is system console writeline in c#?

1039


Why do we need events in c#?

980


What is the use of delegates in c#?

892


Can we inherit private class in c#?

946


What happens during the process of boxing?

1061


What is an escape sequence?

928


What is using keyword in C#?

1031


What is a function c#?

970


Can a struct have a default constructor (a constructor without parameters) or a destructor in c#?

984


What is encapsulation in csharp?

992


What is the lock statement in c#?

997


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

910


What is difference between web and window application?

852


what will be the output of the given below coding. using System; public class Exercise { static void OddNumbers(int a) { if (a >= 1) { Console.Write("{0}, ", a); a -= 2; OddNumbers(a); } } public static int Main() { const int Number = 9; Console.WriteLine("Odd Numbers"); OddNumbers(Number); Console.WriteLine(); return 0; } }

4359