API Reference
Class
CsvObjectWriter
Streams object rows to CSV without materializing a CsvDocument.
Inheritance
- Object
- CsvObjectWriter
Constructors
public CsvObjectWriter(TextWriter writer, CsvSaveOptions options = null, Boolean leaveOpen = false) #Initializes a streaming object writer.
Parameters
- writer System.IO.TextWriter
- Destination text writer.
- options OfficeIMO.CSV.CsvSaveOptions = null
- Optional CSV save options.
- leaveOpen System.Boolean = false
- Whether to leave the destination writer open when this writer is disposed.
Methods
public Void WriteObject(Object item) #Returns:
VoidWrites one object row, inferring columns from the first row.
Parameters
- item System.Object
- Object, dictionary, or flattened row to write.
WriteRow 2 overloads
public Void WriteRow<TState>(IReadOnlyList<String> columns, Int32 valueCount, TState state, Func<TState, Int32, Object> valueAccessor) #Returns:
VoidWrites one already-projected row using the provided column order.
Type Parameters
- TState
Parameters
- columns System.Collections.Generic.IReadOnlyList{System.String}
- Column names for the first row and validation for later rows.
- values System.Collections.Generic.IReadOnlyList{System.Object}
- Values in the same order as columns.
WriteRow(System.Collections.Generic.IReadOnlyList{System.String} columns, System.Object[] values) #Writes one already-projected row using the provided column order.
Parameters
- columns System.Collections.Generic.IReadOnlyList{System.String}
- Column names for the first row and validation for later rows.
- values System.Object[]
- Values in the same order as columns.
WriteRow``1(System.Collections.Generic.IReadOnlyList{System.String} columns, System.Int32 valueCount, ``0 state, System.Func{``0,System.Int32,System.Object} valueAccessor) #Writes one projected row using a caller-provided value accessor.
Type Parameters
- TState
- State type used by the value accessor.
Parameters
- columns System.Collections.Generic.IReadOnlyList{System.String}
- Column names for the first row and validation for later rows.
- valueCount System.Int32
- Number of values exposed by valueAccessor.
- state ``0
- Caller state passed to valueAccessor for each column index.
- valueAccessor System.Func{``0,System.Int32,System.Object}
- Function that returns the value for a column index.
Inherited Methods
public override Boolean Equals(Object obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object
Properties
public Boolean HasRows { get; } #Gets whether at least one row was written.