J
Jeff
IDE: VS .NET 2003
OS: XP pro sp2
I've got a class (class A) which holds reference to n other classes (class
B). The reference from class A to class B is contained in an ArrayList in
class A..
public class A
{
private ArrayList array;
public class A()
{
array = new ArrayList();
}
}
public class B
{
public class B()
{
}
}
class A have got a thread which starts once every minutte, and remove
objects (class B) from the array based on some kind of criteria... (idle)...
Class B contains only .NET (managed) code, and contains also data which I
need saved back to the database when the object is destroyed
I've read this topic on MSDN:
http://msdn.microsoft.com/library/d...l/frlrfSystemIDisposableClassDisposeTopic.asp
My questions:
1)
The link above, mention what to do if I've got a class containing unmanged
code, but my classes contains only managed code. Can I use this example
then?
2)
If I can use the info at the link, where in class B should I place the code
that saves data back to the database (it's a stored procedure)... in public
void Dispose(), private void Dispose(bool disposing) or destructor
3)
If I should place the code in public void Dispose() I would be thankful for
info about where in this metod should I place the call to the stored
procedure (see below):
In public void Dispose()
Should I call the stored procedure between the line "Dispose(true);"
and line "GC.SuppressFinalize(this);"??
Jeff
OS: XP pro sp2
I've got a class (class A) which holds reference to n other classes (class
B). The reference from class A to class B is contained in an ArrayList in
class A..
public class A
{
private ArrayList array;
public class A()
{
array = new ArrayList();
}
}
public class B
{
public class B()
{
}
}
class A have got a thread which starts once every minutte, and remove
objects (class B) from the array based on some kind of criteria... (idle)...
Class B contains only .NET (managed) code, and contains also data which I
need saved back to the database when the object is destroyed
I've read this topic on MSDN:
http://msdn.microsoft.com/library/d...l/frlrfSystemIDisposableClassDisposeTopic.asp
My questions:
1)
The link above, mention what to do if I've got a class containing unmanged
code, but my classes contains only managed code. Can I use this example
then?
2)
If I can use the info at the link, where in class B should I place the code
that saves data back to the database (it's a stored procedure)... in public
void Dispose(), private void Dispose(bool disposing) or destructor
3)
If I should place the code in public void Dispose() I would be thankful for
info about where in this metod should I place the call to the stored
procedure (see below):
In public void Dispose()
Should I call the stored procedure between the line "Dispose(true);"
and line "GC.SuppressFinalize(this);"??
Jeff