コード例 #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
 private SeparatedValueWriter(TextWriter writer, SeparatedValueSchema schema, SeparatedValueOptions options, bool hasSchema)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (hasSchema && schema == null)
     {
         throw new ArgumentNullException("schema");
     }
     if (options == null)
     {
         options = new SeparatedValueOptions();
     }
     this.recordWriter = new SeparatedValueRecordWriter(writer, schema, options);
     this.isFirstLine  = true;
 }