daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     static class EnumerableExtensions
  2.     {
  3.         public static double Max(this IEnumerable<double> source)
  4.         {
  5.             using (var en = source.GetEnumerator())
  6.             {
  7.                 if (!en.MoveNext())
  8.                     throw new ArgumentException("empty seq");
  9.                 var currmax = en.Current;
  10.                 while (en.MoveNext())
  11.                     if (en.Current > currmax)
  12.                         currmax = en.Current;
  13.                 return currmax;
  14.             }
  15.         }
  16.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top