/// <summary> /// Prints line of table data. /// </summary> /// <param name="values">Line values.</param> /// <param name="columnWidths">Array of column widths. If null - value is ignored.</param> /// <returns>String representation of values</returns> public string FormatLine(string[] values, int[] columnWidths) => EnumerableClass // ReSharper disable once InvokeAsExtensionMethod .Zip( values, columnWidths, (s, w) => s.PadLeft(w)) .Join(", ");
public string FormatLine(string[] values, int[] columnWidths) { Code.NotNull(values, nameof(values)); Code.NotNull(columnWidths, nameof(columnWidths)); Code.AssertArgument( values.Length <= columnWidths.Length, nameof(columnWidths), "columnWidth array to short"); return (EnumerableClass // ReSharper disable once InvokeAsExtensionMethod .Zip( values.Select(EscapeValue), columnWidths, (s, w) => s.PadLeft(w)) .Join(", ")); }