using System; using System.Text; namespace CubicSpline { /// /// Utility methods for arrays. /// public static class ArrayUtil { /// /// Create a string to display the array values. /// /// The array /// Optional. A string to use to format each value. Must contain the colon, so something like ':0.000' public static string ToString(T[] array, string format = "") { var s = new StringBuilder(); string formatString = "{0" + format + "}"; for (int i = 0; i < array.Length; i++) { if (i < array.Length - 1) { s.AppendFormat(formatString + ", ", array[i]); } else { s.AppendFormat(formatString, array[i]); } } return s.ToString(); } } }