|
|
|
|
|
by dkersten
5386 days ago
|
|
I prefer: for (int i=this.MyControl.TabPages.Count - 1; i >= 0; i--) {
this.MyControl.TabPages.Remove(this.MyControl.TabPages[i]);
}
Though a simple while loop is much easier to follow, even if its less efficient than removing the elements in reverse. |
|
while (MyControl.TabPages.Count > 0) { MyControl.TabPages.RemoveAt(MyControl.TabPages.Count-1); }
For loop are nothing more than while loops with:
(1) an assignment (int i = MyControl.TabPages.Count in this case)
(2) an extra command (i-- in this case) added to the end