Any managed object is subject to data collection when there are no more
references to it. In your example, the dt member will be garbage collected
at some point after there are no more references to the runtime instance of
Sample1 (unless you have a method of Sample1 that returns a copy of the dt
reference to something outside the class, in which case there might be other
references that would keep it from being garbage-collected even if the
Sample1 instance is destroyed).
--Bob
"R.A." <te**@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
The follwowing remarks taken from the MSDN:
As long as you are using a Timer, you must keep a reference to it. As
with any managed object, a Timer is subject to garbage collection when there
are no references to it. The fact that a Timer is still active does not
prevent it from being collected.
What does this mean?
If I have the following:
class Sample1 : System
{
DataTable dt = new DataTable ();
public process ()
{
while (true)
{
do something
}
}
}
can the dt be delete by the garbage collection?