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 |
What is delegates & multicast delegate?
i want the csharp questions&answeres
Are c# strings null terminated?
What is ac callback?
Advantages of c# over vb.net?
Define c# delegate?
how to insert the data from the grid view to database table though button click.pls send the answer to mail id suri1319@gmail.com
What is the use of 'using' statement in c#?
How does substring work in c#?
What is the use of 'as' Keyword in C# ?
In c#, what will happen if you do not explicitly provide a constructor for a class?
Define Final Class in C#