Welcome to the Lounge

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.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.

i just tried that. my mistake. is this new? the rules for generic covariance i thought i was going by were published back in the 2.0 days. I assumed it hadn't really changed. Or maybe it always worked and I misunderstood it or misremembered it later. Oh well. Thanks.

I probably won't use IReadOnlyList because it's too much churn in my code. If this were a public method I'd consider it.

When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

in my experience the 20x difference comes when you're doing lots and lots of nested foreach operations, like doing a ton of functional style queries, due to the heap pressure of all those object creation and destructions.

in truth, that function was whipped together in a few minutes so I just didn't bother with for loops.

I only think about performance in terms of linear vs log times - basically mathematical complexity of functions.

Beyond that, I profile. So for code like this it gets changed if and when it needs to be.

However, given the nested nature of this call it is probably best to change it to for loops early on.

When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.