I am trying to clear all items from a ToolStripDropDownButton. Since they are disposable, I call the dispose method on each of them. But I see that after calling the dispose() method, the IsDisposed property still returns false. Why is that and how can I check if Dispose() is called on any object ? It is not a problem (I hope) in my current project, but I would really like to know what is going on here...
my code so far :
private void ClearDropDownAccessConnections()
{
ToolStripItem button = null;
for (int i = toolStripDropDownButtonAccess.DropDownItems.Count - 1; i > 0; i--)
{
button = toolStripDropDownButtonAccess.DropDownItems[i] as ToolStripItem;
if ((button.Tag != null) && ((int)button.Tag == 10))
{
toolStripDropDownButtonAccess.DropDownItems.Remove(button);
button.Dispose();
//IF I CHECk HERE THEN button.IsDisposed IS STILL FALSE }
}
}