Skip to main content
13 events
when toggle format what by license comment
Aug 11, 2018 at 17:25 history edited user73941 CC BY-SA 4.0
[Edit removed during grace period]
Aug 11, 2018 at 15:37 history edited user73941 CC BY-SA 4.0
added 60 characters in body
Aug 11, 2018 at 15:27 comment added VisualMelon @t3chb0t sorry, I see what you mean now. Yes, you're absolutely right.
Aug 11, 2018 at 15:25 history edited user73941 CC BY-SA 4.0
added 49 characters in body
Aug 11, 2018 at 15:25 comment added t3chb0t @VisualMelon no, you cannot but you can prevent enumerating the source that you are going to reverse until really necessary. The first implementation doesn't do it and the stack pulls all the items from the source right away. You can check it in linqpad with var reversed = source.Select(x => x.Dump()).Reverse(); - the first one will dump all the items and the second one not.
Aug 11, 2018 at 15:15 comment added VisualMelon Max implementation is a great example. @t3chb0t you can't lazily reverse a lazy IEnumerable ;) you'd have to fast-path IReadonlyList and such to achieve that (where it's possible)
Aug 11, 2018 at 15:14 history edited VisualMelon CC BY-SA 4.0
Fix apparent C&P error.
Aug 11, 2018 at 15:13 history edited user73941 CC BY-SA 4.0
added 279 characters in body
Aug 11, 2018 at 14:49 history edited user73941 CC BY-SA 4.0
deleted 27 characters in body
Aug 11, 2018 at 14:49 comment added user73941 @t3chb0t: You are as usual right... I'll edit
Aug 11, 2018 at 14:48 comment added t3chb0t This is a nice trick with the stack... I think you could just return it without the helper variable. Althogh it has one drawback. It's eager whereas linq is lazy so this API isn't consitant with the others.
Aug 11, 2018 at 14:46 history edited user73941 CC BY-SA 4.0
added 2 characters in body
Aug 11, 2018 at 14:40 history answered user73941 CC BY-SA 4.0