Reply to post: Re: Programming Peter Principle

Mads Torgersen and Dustin Campbell on the future of C#

Adam 1

Re: Programming Peter Principle

> Obviously, YMMV but LINQ, the TPL, async/await, yield return (etc.) all make the older alternatives look awkward.)

Perhaps, but it can also hide a bunch of inefficient loops (thinking linq).

I saw the following line a month back

Var myshashset = new hashset<int>();

// Put some numbers in it

if (myhashset.Any(a => a == 5))

DoSomething;

Put a million numbers into your hashset if you want to know why that is such a bad idea.

Another one I saw was two consecutive aggregate functions, which I had to point out to the author that they were iterating their whole dataset twice.

The others though are brilliant.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon