Click here to Skip to main content
15,892,480 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Confused by team mate... Pin
Jon McKee23-Jul-20 12:33
professionalJon McKee23-Jul-20 12:33 
GeneralRe: Confused by team mate... Pin
Johnny J.21-Jul-20 21:22
professionalJohnny J.21-Jul-20 21:22 
GeneralRe: Confused by team mate... Pin
OriginalGriff21-Jul-20 20:00
mveOriginalGriff21-Jul-20 20:00 
GeneralRe: Confused by team mate... Pin
Super Lloyd21-Jul-20 20:12
Super Lloyd21-Jul-20 20:12 
GeneralRe: Confused by team mate... Pin
OriginalGriff21-Jul-20 20:14
mveOriginalGriff21-Jul-20 20:14 
GeneralRe: Confused by team mate... Pin
Super Lloyd21-Jul-20 20:35
Super Lloyd21-Jul-20 20:35 
GeneralRe: Confused by team mate... Pin
Super Lloyd21-Jul-20 20:38
Super Lloyd21-Jul-20 20:38 
GeneralRe: Confused by team mate... Pin
OriginalGriff21-Jul-20 20:18
mveOriginalGriff21-Jul-20 20:18 
Re my performance comment, I just looked at the source for RemoveAll, and it's well written:
C#
// This method removes all items which matches the predicate.
        // The complexity is O(n).   
        public int RemoveAll(Predicate<T> match) {
            if( match == null) {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
            }
            Contract.Ensures(Contract.Result<int>() >= 0);
            Contract.Ensures(Contract.Result<int>() <= Contract.OldValue(Count));
            Contract.EndContractBlock();
    
            int freeIndex = 0;   // the first free slot in items array
 
            // Find the first item which needs to be removed.
            while( freeIndex < _size && !match(_items[freeIndex])) freeIndex++;            
            if( freeIndex >= _size) return 0;
            
            int current = freeIndex + 1;
            while( current < _size) {
                // Find the first item which needs to be kept.
                while( current < _size && match(_items[current])) current++;            
 
                if( current < _size) {
                    // copy item to the free slot.
                    _items[freeIndex++] = _items[current++];
                }
            }                       
            
            Array.Clear(_items, freeIndex, _size - freeIndex);
            int result = _size - freeIndex;
            _size = freeIndex;
            _version++;
            return result;
        }
Because it's got direct access to the underlying array, it moves as little memory as it has to. Nice - and worth using!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Confused by team mate... Pin
Super Lloyd21-Jul-20 20:36
Super Lloyd21-Jul-20 20:36 
GeneralRe: Confused by team mate... Pin
Sander Rossel21-Jul-20 21:49
professionalSander Rossel21-Jul-20 21:49 
GeneralRe: Confused by team mate... Pin
5teveH21-Jul-20 22:24
5teveH21-Jul-20 22:24 
GeneralRe: Confused by team mate... Pin
F-ES Sitecore22-Jul-20 1:35
professionalF-ES Sitecore22-Jul-20 1:35 
RantRe: Confused by team mate... Pin
MehreenTahir22-Jul-20 4:14
MehreenTahir22-Jul-20 4:14 
GeneralRe: Confused by team mate... Pin
Super Lloyd22-Jul-20 5:00
Super Lloyd22-Jul-20 5:00 
GeneralRe: Confused by team mate... Pin
Marc Clifton22-Jul-20 4:14
mvaMarc Clifton22-Jul-20 4:14 
GeneralRe: Confused by team mate... Pin
Super Lloyd22-Jul-20 4:59
Super Lloyd22-Jul-20 4:59 
JokeRe: Confused by team mate... Pin
abmv22-Jul-20 4:30
professionalabmv22-Jul-20 4:30 
GeneralRe: Confused by team mate... Pin
W Balboos, GHB22-Jul-20 5:01
W Balboos, GHB22-Jul-20 5:01 
GeneralRe: Confused by team mate... Pin
Gerry Schmitz22-Jul-20 10:17
mveGerry Schmitz22-Jul-20 10:17 
GeneralThought of the Day Pin
OriginalGriff21-Jul-20 4:40
mveOriginalGriff21-Jul-20 4:40 
GeneralRe: Thought of the Day Pin
W Balboos, GHB21-Jul-20 4:55
W Balboos, GHB21-Jul-20 4:55 
QuestionRe: Thought of the Day Pin
Daniel Pfeffer21-Jul-20 5:14
professionalDaniel Pfeffer21-Jul-20 5:14 
GeneralRe: Thought of the Day Pin
User 1106097921-Jul-20 5:44
User 1106097921-Jul-20 5:44 
GeneralRe: Thought of the Day Pin
honey the codewitch21-Jul-20 6:34
mvahoney the codewitch21-Jul-20 6:34 
GeneralRe: Thought of the Day Pin
Eddy Vluggen21-Jul-20 10:55
professionalEddy Vluggen21-Jul-20 10:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.