4 ms·
Why not just: while (this.MyControl.TabPages.Count > 0) { this.MyControl.TabPages.Remove ( 0 ); }
by AlexandrB 15y ago
Why not just:
while (this.MyControl.TabPages.Count > 0)
{
this.MyControl.TabPages.Remove ( 0 );
}
- masklinn 15y agoVery inefficient on most array lists (but a very good idea on linked lists)
- tomjen3 15y agoHow many tabs do you use? Less than 50? Then don't worry about the optimization until you have to port it to a PDP10.
- tlrobinson 15y agowhile (this.MyControl.TabPages.Count > 0) { this.MyControl.TabPages.Remove ( this.MyControl.TabPages.Count-1 ); }
- hasslblad 15y agoOr Even this.MyControl.TabPages.Clear();
- qntm 15y agoIndeed. But the point I was making was that this hypothetical coder introduced more complexity by adding "i--;" whereas the code could equally well be fixed, in the same number of keystrokes, while reducing complexity, by removing "i++;".