News for hackers. Stuff that matters.
Re:What’s New in C# 7.0 by lgessler on Thursday August 25, 2016 @10:14AM (#12359120)
The thing is, though, would those be allowed by style guides at the enterprise companies where C# is most common?

The C# style guide of a former employer of mine (an enterprise C# user) forbids both of these snippets because of the unbraced statements in the former and the LINQ and lambdas in the latter. But admittedly I don't know what's common among C# users, so maybe they were in the minority.

Re:What’s New in C# 7.0 by JamesBarney on Thursday August 25, 2016 @11:17AM (#12359650)
5-6 years ago enterprise guidelines preventing LINQ/lambda's were more common. Current C# practices for enterprise companies(familiar with 6+ fortune 500's, have not seen or heard of them being banned in the last 4 years) definitely allow lambdas and LINQ.

The "required brackets" is more common but I think it's a good rule :). Readability is only slightly hindered by the extra brackets, but I've seen quite a few errors from

if(shibboleth)

    DoSomething();

    DoSomethingElse();
Re:What’s New in C# 7.0 by briHass on Thursday August 25, 2016 @10:53AM (#12359452)
The brackets, maybe. Preferences for brackets for single lines vary. I personally don't like them, but many code style guides (including MS's) recommend them.

The LINQ version should be allowed almost everywhere that has a good development group. Sometimes LINQ queries can get hairier than the equivalent foreach, but I've never worked anywhere that would frown upon the shorter/cleaner LINQ.

Re:What’s New in C# 7.0 by brusch64 on Monday August 29, 2016 @03:06AM (#12380479)
I think its strange comparing languages and then saying that the point doesn't stand because code guidelines of companies don't support the more compact version.

I don't like the version without brackets, but I don't think it would make the code less compact if you'd add brackets.