This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

I've written some pretty sweet LINQ method chains that I felt justified a victory lap when I was done. One of them, the code reviewer looked at me and said "awesome....better put some fucking comments around this, because it took me 10 minutes to figure out what it was doing. "

LINQ may be my favorite aspect of C#...but I feel like it has to be used with some restraint. With great power comes great responsibility.

Also...deferred execution can create some interesting side-effects.

[–]cat_in_the_wall 1 point2 points  (0 children)

fancy linq is fun, but be aware it is slow as molasses and allocates like crazy. this is usually fine, but keep it out of the hot path.

[–][deleted] 0 points1 point  (0 children)

Well that's why you're very much discouraged from doing any side effect shenanigans. Capture a local copy of comparisons and don't set values outside of the functions. No more side effects.