DEV Community

Discussion on: Two CSharp idioms

Collapse
 
serinus1 profile image
Serinus1

Granted, they're just examples, but in the examples given the first solution is better. It's immediately obvious what you're doing to any programmer of any skill level from any language, and they take fewer lines.

The "idioms" as you call them can be useful tricks, but they require overhead knowledge. More developers are familiar with "or" and boolean logic than lambdas and linq. I would avoid using these tricks in the examples given. I would look to use these if they reduced, say 50 lines into 5 lines. In that case the overhead knowledge requirement is serving a purpose.

You always should have a reason to be clever and don't just try to be clever for the sake of it. Keep it simple and stupid whenever possible.