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 the example of predicate?
What is data adapter in c#?
Why is static constructor called first?
what is the difference between interface and multiple interface?
What is private in c#?
How can i Spawn a Thread
Does c# support templates?
What is the difference between read and readline in c#?
Why do we need interface in c#?
How to find type of variable?
how to sort an array in c#
ctype(123.34,integer) - should it throw an error? Why or why not?