Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static class EnumerableExtensions
- {
- public static double Max(this IEnumerable<double> source)
- {
- using (var en = source.GetEnumerator())
- {
- if (!en.MoveNext())
- throw new ArgumentException("empty seq");
- var currmax = en.Current;
- while (en.MoveNext())
- if (en.Current > currmax)
- currmax = en.Current;
- return currmax;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement