예제 #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();
            SeparatedValueRecordWriter recordWriter = new SeparatedValueRecordWriter(writer, schema, options);

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
예제 #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="System.ArgumentNullException">The values array is null.</exception>
 public void Write(object[] values)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     if (isFirstLine)
     {
         if (recordWriter.Options.IsFirstRecordSchema && recordWriter.Schema != null)
         {
             recordWriter.WriteSchema();
             recordWriter.WriteRecordSeparator();
         }
         isFirstLine = false;
     }
     recordWriter.WriteRecord(values);
     recordWriter.WriteRecordSeparator();
 }