CSharp examples for System:Array Find
Finds the minimum value in the specified 2D array.
public class Main{ /// <summary> /// Finds the minimum value in the specified 2D array. /// </summary> /// <param name="array">The array.</param> /// <param name="excludeNaN">Exclude NaN values if set to <c>true</c>.</param> /// <returns>The minimum value.</returns> public static double Min2D(this double[,] array, bool excludeNaN = false) {/*from www. ja va 2s . co m*/ var min = double.MaxValue; for (var i = 0; i < array.GetLength(0); i++) { for (var j = 0; j < array.GetLength(1); j++) { if (excludeNaN && double.IsNaN(array[i, j])) { continue; } if (array[i, j].CompareTo(min) < 0) { min = array[i, j]; } } } return min; } }