Open GoogleCodeExporter opened 9 years ago
Compelling feature!
Original comment by Weitzhan...@gmail.com
on 23 Nov 2012 at 8:37
I need this right now !
Original comment by rdingw...@gmail.com
on 5 Dec 2012 at 1:04
You can implement this easily with a combination of using nullables and
Prepend/Concat a null before calling Min/Max, like this:
var some = Enumerable.Range(10, 10);
var none = Enumerable.Range(10, 0);
Console.WriteLine(some.Cast<int?>().Prepend(null).Min()); // prints 10
Console.WriteLine(none.Cast<int?>().Prepend(null).Min()); // prints null
Console.WriteLine(some.Cast<int?>().Prepend(null).Max()); // prints18
Console.WriteLine(none.Cast<int?>().Prepend(null).Max()); // prints null
Once you have a null you can use ?? fault in a value. The implementation in the
blog article[1] suffers from iterating the sequence twice.
[1]
http://blogs.telerik.com/xamlteam/posts/08-10-17/linq-sequence-contains-no-eleme
nts-extension-methods-to-the-rescue.aspx
Original comment by azizatif
on 22 Jun 2013 at 12:15
This issue has been migrated to:
https://github.com/MoreLINQ/morelinq/issues/28
The conversation continues there.
DO NOT post any further comments to the issue tracker on Google Code as it is
shutting down.
You can also just subscribe to the issue on GitHub to receive notifications of
any further development.
Original comment by azizatif
on 21 Aug 2015 at 6:55
Original issue reported on code.google.com by
anton.ge...@gmail.com
on 17 Sep 2009 at 8:56