标签:col c# 数组 bsp ati 最小值 for name static
工具类如下:
public class ArrayHelper { #region Double数组最大值 /// <summary> /// Double数组最大值 /// </summary> /// <param name="array"></param> /// <returns></returns> public static double DoubleMax(double[] array) { if (array == null) return 0; if (array.Length <= 0) return 0; double max = array[0]; for (int i = 1; i < array.Length; i++) { if (max < array[i]) { max = array[i]; } } return max; } #endregion #region Double数组最小值 /// <summary> /// Double数组最小值 /// </summary> /// <param name="array"></param> /// <returns></returns> public static double DoubleMin(double[] array) { if (array == null) return 0; if (array.Length <= 0) return 0; double min = array[0]; for (int i = 1; i < array.Length; i++) { if (min > array[i]) { min = array[i]; } } return min; } #endregion #region int数组最大值 /// <summary> /// int数组最大值 /// </summary> /// <param name="num"></param> /// <returns></returns> public static int IntMax(int[] num) { if (num == null) return 0; if (num.Length <= 0) return 0; int a = num[0]; for (int i = 0; i < num.Length; i++) { if (a < num[i]) { a = num[i]; } } return a; } #endregion #region int数组最小值 /// <summary> /// int数组最小值 /// </summary> /// <param name="num"></param> /// <returns></returns> public static int IntMin(int[] num) { if (num == null) return 0; if (num.Length <= 0) return 0; int a = num[0]; for (int i = 0; i < num.Length; i++) { if (a > num[i]) { a = num[i]; } } return a; } #endregion }
标签:col c# 数组 bsp ati 最小值 for name static
原文地址:http://www.cnblogs.com/bmbh/p/7610219.html