4 ms·
So what's the "correct" way to do this? Clearing the entire array can usually be accomplished easily, but what if you want to remove only items matching some c
by tlrobinson 15y ago
So what's the "correct" way to do this?
Clearing the entire array can usually be accomplished easily, but what if you want to remove only items matching some condition?
Looping backwards, perhaps?
for ( int i=this.MyControl.TabPages.Count-1 ; i >= 0 ; i-- )
{
this.MyControl.TabPages.Remove ( this.MyControl.TabPages[i] );
}
- sid0 15y agoAs I mentioned above, the best way to keep items matching a condition is filter predicate xs
- IvoDankolov 15y agoIn case you don't speak Haskell: IEnumerable<T>.Where(Func<T, bool> predicate) It's quite simple to use: var odd_numbers = numbers.Where( n => n%2 == 1 );