S
Sam Sungshik Kong
Hello, folks!
I am trying to understand how IsDisposed property of Control class works.
I need to use the following code in my application.
if frm == null or frm.IsDisposed
...
MS explains about IsDisposed like the following.
<snip>
When this property returns true, the control is disposed of and can no
longer be referenced as a valid Windows control. Even though the instance of
a control is disposed of, it is still maintained in memory until it is
removed from memory through garbage collection.
</snip>
I don't understand several things regarding above explanation and
IsDisposed.
1. Is a control maintained in memory even after it's disposed?
2. If a control is garbage collected, how can I access the IsDisposed
property (property is part of control)?
3. Can I rely on the code (if frm == null or frm.IsDisposed) when I want to
check if the frm is created and accessible?
Thanks.
Sam
I am trying to understand how IsDisposed property of Control class works.
I need to use the following code in my application.
if frm == null or frm.IsDisposed
...
MS explains about IsDisposed like the following.
<snip>
When this property returns true, the control is disposed of and can no
longer be referenced as a valid Windows control. Even though the instance of
a control is disposed of, it is still maintained in memory until it is
removed from memory through garbage collection.
</snip>
I don't understand several things regarding above explanation and
IsDisposed.
1. Is a control maintained in memory even after it's disposed?
2. If a control is garbage collected, how can I access the IsDisposed
property (property is part of control)?
3. Can I rely on the code (if frm == null or frm.IsDisposed) when I want to
check if the frm is created and accessible?
Thanks.
Sam