private FormatValues ( object values ) : string[] | ||
values | object | The values to format. |
return | string[] |
public void WriteRecord(object[] values) { if (values.Length != schema.ColumnDefinitions.HandledCount) { throw new ArgumentException(SharedResources.WrongNumberOfValues, "values"); } var formattedColumns = schema.FormatValues(values); var fittedColumns = formattedColumns.Select((v, i) => fitWidth(schema.Windows[i], v)); foreach (string column in fittedColumns) { writer.Write(column); } }
private string[] formatValues(object[] values, FixedLengthSchema schema) { var metadata = injector == null ? Metadata : new FixedLengthWriterMetadata() { Schema = schema, Options = Metadata.Options, RecordCount = Metadata.RecordCount, LogicalRecordCount = Metadata.LogicalRecordCount }; return(schema.FormatValues(metadata, values)); }
/// <summary> /// Writes the textual representation of the given values to the writer. /// </summary> /// <param name="values">The values to write.</param> /// <exception cref="System.ArgumentNullException">The values array is null.</exception> public void Write(object[] values) { if (isDisposed) { throw new ObjectDisposedException("FixedLengthWriter"); } if (values == null) { throw new ArgumentNullException("values"); } if (values.Length != schema.ColumnDefinitions.Count) { throw new ArgumentException(Resources.WrongNumberOfValues, "values"); } foreach (string column in schema.FormatValues(values).Select((v, i) => fitWidth(i, v))) { writer.Write(column); } writer.Write(options.RecordSeparator); }