Exemplo n.º 1
0
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="value">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        public override string Format(object value)
        {
            object[] values = value as object[];
            if (values == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            StringWriter            writer       = new StringWriter();
            FixedLengthRecordWriter recordWriter = new FixedLengthRecordWriter(writer, schema, options);

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Writes the textual representation of the given values to the writer.
 /// </summary>
 /// <param name="values">The values to write.</param>
 /// <exception cref="ArgumentNullException">The values array is null.</exception>
 public void Write(object[] values)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     if (isFirstLine)
     {
         if (recordWriter.Options.IsFirstRecordHeader)
         {
             recordWriter.WriteSchema();
             recordWriter.WriteRecordSeparator();
         }
         isFirstLine = false;
     }
     recordWriter.WriteRecord(values);
     recordWriter.WriteRecordSeparator();
 }