-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Implement IIListProvider on Distinct() and Union(). #6129
Conversation
case 1: | ||
_enumerator = _first.GetEnumerator(); | ||
if (_enumerator.MoveNext()) | ||
state = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add braces here.
(In general, I don't like the style that's currently used through LINQ; it doesn't match what we've been trying to do in the rest of corefx. Cleaning that up if @VSadov agrees should be a separate effort at some point. In the meantime, though, in a case like this it just looks really strange to have an else with braces but the if without.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funnily enough while I do like brace-less two lines and hate the brace-less one-line used in this project, I've caught myself writing brace-less one-liners of late. This project is rubbing off on me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also like the corefx style more. Except for the avoidance of "var". :-)
We should run the formatter tool at some point on Linq and Expressions just for consistency.
Entered https://github.com/dotnet/corefx/issues/6150 for this.
LGTM |
LGTM |
Optimised ToArray and ToList() on the results of these methods.
871bb0e
to
6ab12bd
Compare
Have fixed the braces. A second commit here, not merged in yet so it can be dropped if you prefer, does a similar optimisation on chained unions to Stephen's for chained concatenations. While chained unions aren't as common, they aren't unheard of (the way to union 3+ sequences is to union and then union, after all) and this has the advantage of only having to create and fill a single hash set, rather than allocating and filling a new one for each call to |
Mind creating a separate PR? |
Sure. Not being sure whether to include it in this or not is exactly why I didn't squash it in. |
6ab12bd
to
01d12cd
Compare
There, that's as the original was, bar the braces. |
Test Innerloop Ubuntu Release Build and Test please |
Implement IIListProvider on Distinct() and Union().
…array Implement IIListProvider on Distinct() and Union(). Commit migrated from dotnet/corefx@3377742
Optimised
ToArray()
andToList()
on the results of these methods.cc: @stephentoub @VSadov