private static int Calculate(GcdAlgorithmDelegate algorithm, int a, int b) { if ((a == 0) || (b == 0)) { throw new ArgumentException("None of numbers should be equal to zero"); } return(algorithm(a, b)); }
private static int Calculate(GcdAlgorithmDelegate algorithm, out long time, params int[] numbers) { Stopwatch sw = new Stopwatch(); sw.Start(); int result = Calculate(algorithm, numbers); sw.Stop(); time = sw.ElapsedMilliseconds; return result; }
private static int Calculate(GcdAlgorithmDelegate algorithm, out long time, int a, int b, int c) { Stopwatch sw = new Stopwatch(); sw.Start(); int result = Calculate(algorithm, a, b, c); sw.Stop(); time = sw.ElapsedMilliseconds; return result; }
private static int Calculate(GcdAlgorithmDelegate algorithm, out long time, int a, int b, int c) { Stopwatch sw = new Stopwatch(); sw.Start(); int result = Calculate(algorithm, a, b, c); sw.Stop(); time = sw.ElapsedMilliseconds; return(result); }
private static int Calculate(GcdAlgorithmDelegate algorithm, out long time, params int[] numbers) { Stopwatch sw = new Stopwatch(); sw.Start(); int result = Calculate(algorithm, numbers); sw.Stop(); time = sw.ElapsedMilliseconds; return(result); }
private static int Calculate(GcdAlgorithmDelegate algorithm, params int[] numbers) { if (numbers == null) throw new ArgumentNullException(); if (numbers.Count() < 2) throw new ArgumentException(); int output = numbers[0]; for (int i = 1; i < numbers.Length; i++) { output = Calculate(algorithm,output, numbers[i]); } return output; }
private static int Calculate(GcdAlgorithmDelegate algorithm, params int[] numbers) { if (numbers == null) { throw new ArgumentNullException(); } if (numbers.Count() < 2) { throw new ArgumentException(); } int output = numbers[0]; for (int i = 1; i < numbers.Length; i++) { output = Calculate(algorithm, output, numbers[i]); } return(output); }
private static int Calculate(GcdAlgorithmDelegate algorithm, int a, int b, int c) => Calculate(algorithm, a, Calculate(algorithm, b, c));
private static int Calculate(GcdAlgorithmDelegate algorithm,int a, int b) { if ((a == 0) || (b == 0)) throw new ArgumentException("None of numbers should be equal to zero"); return algorithm(a, b); }
private static int Calculate(GcdAlgorithmDelegate algorithm, int a, int b, int c) => Calculate(algorithm, a, Calculate(algorithm, b, c));