How to Dispose myClass with Garbage Collecter C#
Posted
by Ibrahim AKGUN
on Stack Overflow
See other posts from Stack Overflow
or by Ibrahim AKGUN
Published on 2010-05-10T14:10:33Z
Indexed on
2010/05/10
14:14 UTC
Read the original article
Hit count: 181
c#
Hi,
I have a class and got a method that doin so many things in memory and need to be disposed when its jobs done.But i have looked for MSDN for solution.There is an example thats not solved my problem.When my Class is instanced and run this method my memory is getting bigger and bigger.How can i Dispose it when its job done ? Here is my CODES ;
class Deneme
{
public Deneme()
{ }
~Deneme()
{
GC.Collect();
GC.SuppressFinalize(this);
}
public void TestMetodu()
{
System.Windows.Forms.MessageBox.Show("Test");
// This is my method that doing big jobs :)
}
}
Deneme CCCX = new Deneme();
CCCX.TestMetodu();
CCCX = null;
So i cant dispose it with this.
© Stack Overflow or respective owner