I am working on a windows form that has a TabControl named tabDocuments. I came across this piece of code that removes all pages from the TabControl.
for (int i = tabDocuments.TabPages.Count - 1; i > -1; i--) {
tabDocuments.TabPages[i].Dispose();
}
tabDocuments.TabPages.Clear();
The person who wrote this code has already left a while ago. I am trying to understand why the code is calling Clear() after disposing each of the tabPages (looks un-necessary to me). Can anyone please explain to me why? Or is calling Clear() extra?