J
Jazper
hi
i have this problem. i made a class deverted by CRootItem with
implementation of IDisposable-Interface. i made a test-funktion to test my
Dispose-Method.... but when set a breakpoint in my Dispose-Method and call
the GC nothing happend!!! my Disposemethod has never been called!! so the GC
dont call my Dispose-Method although I implemented IDisposable?
what am i doing wrong?
Regards, Jazper
---Code ---------------------------------------------------------------
private void Test()
{
for(int i=0; i < 50000; i++)
{
CEmployee oEmployee = new CEmployee();
}
GC.Collect();
}
public class CEmployee : CRootItem, IDisposable
{
protected OleDbDataAdapter _Adapter;
protected DataTable _Data;
public void Dispose()
{
this._Adapter.Dispose(); //BRAKPOINT HERE!!
this._Data.Dispose();
}
public CEmployee()
{
this._Adapter = new OleDbDataAdapter();
this._Data = new DataTable();
}
}
i have this problem. i made a class deverted by CRootItem with
implementation of IDisposable-Interface. i made a test-funktion to test my
Dispose-Method.... but when set a breakpoint in my Dispose-Method and call
the GC nothing happend!!! my Disposemethod has never been called!! so the GC
dont call my Dispose-Method although I implemented IDisposable?
what am i doing wrong?
Regards, Jazper
---Code ---------------------------------------------------------------
private void Test()
{
for(int i=0; i < 50000; i++)
{
CEmployee oEmployee = new CEmployee();
}
GC.Collect();
}
public class CEmployee : CRootItem, IDisposable
{
protected OleDbDataAdapter _Adapter;
protected DataTable _Data;
public void Dispose()
{
this._Adapter.Dispose(); //BRAKPOINT HERE!!
this._Data.Dispose();
}
public CEmployee()
{
this._Adapter = new OleDbDataAdapter();
this._Data = new DataTable();
}
}