3 ms·
You can use C# fat arrow syntax, it even allows removing the braces for single expression lambdas which is the most common from anyway.
by rubber_duck 10y ago
You can use C# fat arrow syntax, it even allows removing the braces for single expression lambdas which is the most common from anyway.
- vanderZwan 10y ago> removing the braces If I have learned anything over the years, it's that removing the braces anywhere is the introduction of a bug during a rewrite waiting to happen.
- rubber_duck 10y agoIt really works without any issues in C# from my experience. Statemends like : list.Where(e => e.Property == ExpectedValue).Select(e => e.Property) is much cleaner than something like : list.Where([](auto e) { return e.Property == ExpectedValue; }).Select([](auto e) { return e.Property; }); Braces and capture declaration adds 0 value here and it's ~80% of the use cases I see for lambdas.