The Daily WTF
Functional programming is fine. It’s a different way of thinking about programs, but it makes some problems very easy to describe. It’s a tool that belongs in the toolbox, and you should use the right tool for the job.
LH‘s co-worker doesn’t quite take that approach. Their solution to pretty much every problem is to use lambdas, and the functional switch expression in C#. But, when combined with their coding style, it creates some… interesting code.
public bool IsSuccessCode => 299 >= (int)StatusCode && (int)StatusCode >= 200 && Response switch { ResultMessage rm => rm.ResultMessageCode == ResultMessageCode.Done, _ => throw new NotImplementedException() };
This is a C# “expression body definition”. It initializes the member property IsSuccessCode using a lambda. The => operator is what marks this as a lambda. And then our eyes get visually confused, because the rest of the lambda depends on a series of >= operators,
To read the full article click on the 'post' link at the top.