CsvDocument
OfficeIMO.CSV
Represents a CSV document with a fluent, document-centric API. Thread-safe for independent read enumeration; not thread-safe for concurrent mutations on the same instance.
Inheritance
- object
- CsvDocument
Usage
Explore 27 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 22
- Method CsvDocument.AddColumn
- Method CsvDocument.AddRow
- Method CsvDocument.Create
- Method CsvDocument.EnsureInferredSchema
- Method CsvDocument.EnsureSchema
- Method CsvDocument.Filter
- Method CsvDocument.FromObjects
- Method CsvDocument.Load
- Method CsvDocument.LoadAsync
- Method CsvDocument.Parse
- Method CsvDocument.RemoveColumn
- Method CsvDocument.SortBy
- Method CsvDocument.SortBy``1
- Method CsvDocument.Transform
- Method CsvDocument.Validate
- Method CsvDocument.ValidateOrThrow
- Method CsvDocument.WithCulture
- Method CsvDocument.WithDateTimeFormats
- Method CsvDocument.WithDelimiter
- Method CsvDocument.WithEncoding
- Method CsvDocument.WithHeader
- Method CsvDocument.WithMappingErrorValuePolicy
Accepted by parameters 5
- Extension method CsvDocument.RowsAsParallel``1
- Extension method CsvDocument.RowsAs``1
- Method CsvDocument.Transform
- Method CsvMappingExtensions.RowsAsParallel``1
- Method CsvMappingExtensions.RowsAs``1
Methods
public CsvDocument AddColumn(string name, Func<CsvRow, object?> valueFactory) #Adds a computed column to the document.
Parameters
- name string
- valueFactory System.Func<OfficeIMO.CSV.CsvRow, object?>
Returns
CsvDocumentpublic CsvDocument AddRow(params object?[] values) #Adds a new row to the document.
Parameters
- values object?[]
Returns
CsvDocumentpublic CsvDocument AddRow(CsvRow row) #Adds an existing row instance to the document.
Parameters
- row OfficeIMO.CSV.CsvRow
Returns
CsvDocumentpublic static Task<TAccumulator?> AggregateRowsAsParallelAsync<TAccumulator>(string path, Func<TAccumulator?> createAccumulator, CsvRecordAccumulatorBuilder<TAccumulator?> accumulatorBuilder, Func<TAccumulator?, TAccumulator?, TAccumulator?> merge, CsvReaderOptions? options = null, ParallelRowMappingOptions? parallelOptions = null, CancellationToken cancellationToken = default) #Aggregates CSV file records with incremental asynchronous I/O and bounded worker-owned states.
Type Parameters
- TAccumulator
- Caller-owned accumulator state, including value types.
Parameters
- path string
- Source CSV file.
- createAccumulator System.Func<TAccumulator?>
- Creates an independent neutral state for the result and each batch. May run concurrently.
- accumulatorBuilder OfficeIMO.CSV.CsvRecordAccumulatorBuilder<TAccumulator?>
- Called once after resolving the header to build the record callback.
- merge System.Func<TAccumulator?, TAccumulator?, TAccumulator?>
- Associatively combines completed states in source-batch order.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Optional parsing, encoding, compression, cancellation and input-limit settings.
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- Optional degree and maximum records per batch.
- cancellationToken System.Threading.CancellationToken = default
- Cancels input, processing between records, and merging between batches.
Returns
Task<TAccumulator?> The accumulated result. Empty input returns the neutral state.public static Task<TAccumulator?> AggregateRowsAsParallelAsync<TAccumulator>(Stream stream, Func<TAccumulator?> createAccumulator, CsvRecordAccumulatorBuilder<TAccumulator?> accumulatorBuilder, Func<TAccumulator?, TAccumulator?, TAccumulator?> merge, CsvReaderOptions? options = null, ParallelRowMappingOptions? parallelOptions = null, CancellationToken cancellationToken = default) #Aggregates CSV records from the stream's current position using incremental asynchronous I/O.
Type Parameters
- TAccumulator
- Caller-owned accumulator state, including value types.
Parameters
- stream System.IO.Stream
- Readable source. Its position advances and it remains open on success and failure.
- createAccumulator System.Func<TAccumulator?>
- Creates independent neutral result and batch states. May run concurrently.
- accumulatorBuilder OfficeIMO.CSV.CsvRecordAccumulatorBuilder<TAccumulator?>
- Called once after resolving the header to build the record callback.
- merge System.Func<TAccumulator?, TAccumulator?, TAccumulator?>
- Associatively combines completed states in source-batch order.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Optional parsing, encoding, compression, cancellation and input-limit settings.
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- Optional degree and maximum records per batch.
- cancellationToken System.Threading.CancellationToken = default
- Cancels input, processing between records, and merging between batches.
Returns
Task<TAccumulator?> The accumulated result. Empty input returns the neutral state.public static TAccumulator? AggregateTextRowsAsParallel<TAccumulator>(string text, Func<TAccumulator?> createAccumulator, CsvRecordAccumulatorBuilder<TAccumulator?> accumulatorBuilder, Func<TAccumulator?, TAccumulator?, TAccumulator?> merge, CsvReaderOptions? options = null, ParallelRowMappingOptions? parallelOptions = null, CancellationToken cancellationToken = default) #Aggregates decoded CSV records into independent partition states and merges them in source order.
Type Parameters
- TAccumulator
- Caller-owned accumulator state, including value types.
Parameters
- text string
- Already-decoded CSV text.
- createAccumulator System.Func<TAccumulator?>
- Creates an independent, neutral state for the result and each partition. May run concurrently.
- accumulatorBuilder OfficeIMO.CSV.CsvRecordAccumulatorBuilder<TAccumulator?>
- Called once on the calling thread to resolve headers and build the record callback.
- merge System.Func<TAccumulator?, TAccumulator?, TAccumulator?>
- Combines the result with a completed partition state. Called on the calling thread in source-partition order.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Optional CSV parsing and input-limit settings.
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- Optional degree and source partition size.
- cancellationToken System.Threading.CancellationToken = default
- Cancels parsing, record callbacks between records, and merging between partitions.
Returns
TAccumulator? The accumulated result. Empty input returns the neutral state.public IEnumerable<CsvRow> AsEnumerable() #Returns rows as an enumerable sequence. In streaming mode this is lazy.
Returns
IEnumerable<CsvRow>public static CsvDocument Create(string path) #Creates an empty document associated with a path without writing a file.
Parameters
- path string
Returns
CsvDocumentpublic CsvDataReader CreateDataReader(CsvReaderOptions? options = null) #Creates a forward-only data reader over the document rows.
Parameters
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Reader projection options. When omitted, all columns are emitted as strings.
public void Dispose() #Completes this managed document's lifetime. No file or caller-owned stream is held open.
public CsvDocument EnsureInferredSchema(int sampleSize = 1000) #Infers and attaches a schema to the document so subsequent validation uses the sampled structure.
Parameters
- sampleSize int = 1000
- Maximum number of rows to inspect. Defaults to 1000.
public CsvDocument EnsureSchema(Action<CsvSchemaBuilder> buildAction) #Attaches a schema to the document.
Parameters
- buildAction System.Action<OfficeIMO.CSV.CsvSchemaBuilder>
Returns
CsvDocumentpublic CsvDocument Filter(Func<CsvRow, bool> predicate) #Filters rows using the provided predicate.
Parameters
- predicate System.Func<OfficeIMO.CSV.CsvRow, bool>
Returns
CsvDocumentpublic static CsvDocument FromObjects(IEnumerable<object?> items, char delimiter = ',', CultureInfo? culture = null, Encoding? encoding = null) #Creates a CSV document from a sequence of objects by projecting their properties or dictionary keys into columns.
Parameters
- items System.Collections.Generic.IEnumerable<object?>
- Sequence of objects to convert into CSV rows.
- delimiter char = ','
- Delimiter to use for the CSV document.
- culture System.Globalization.CultureInfo? = null
- Optional culture for value formatting.
- encoding System.Text.Encoding? = null
- Optional encoding for file operations.
public CsvSchema InferSchema(int sampleSize = 1000) #Infers a schema from the document header and sampled row values.
Parameters
- sampleSize int = 1000
- Maximum number of rows to inspect. Defaults to 1000.
public static CsvDocument Load(string path, CsvLoadOptions? options = null) #Loads a CSV document from disk.
Parameters
- path string
- options OfficeIMO.CSV.CsvLoadOptions? = null
Returns
CsvDocumentpublic static CsvDocument Load(Stream stream, CsvLoadOptions? options = null) #Loads a CSV document from a stream.
Parameters
- stream System.IO.Stream
- Source stream.
- options OfficeIMO.CSV.CsvLoadOptions? = null
- Load options.
Returns
CsvDocumentpublic static async Task<CsvDocument> LoadAsync(string path, CsvLoadOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously loads a CSV document from disk.
Parameters
- path string
- options OfficeIMO.CSV.CsvLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<CsvDocument>public static async Task<CsvDocument> LoadAsync(Stream stream, CsvLoadOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously loads a CSV document from a caller-owned stream.
Parameters
- stream System.IO.Stream
- options OfficeIMO.CSV.CsvLoadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<CsvDocument>public static CsvDataReader OpenReader(string path, CsvReaderOptions? options = null) #Creates a forward-only data reader over a CSV file.
Parameters
- path string
- Source CSV path.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Parsing and projection settings. Columns are strings unless a schema is supplied or inferred.
public static CsvDataReader OpenReader(Stream stream, CsvReaderOptions? options = null) #Opens a forward-only data reader over a CSV stream.
Parameters
- stream System.IO.Stream
- Readable CSV stream. The stream remains open after the reader is disposed.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Parsing and projection settings. Columns are strings unless a schema is supplied or inferred.
public static CsvDataReader OpenReader(TextReader reader, CsvReaderOptions? options = null) #Opens a forward-only reader over decoded CSV text.
Parameters
- reader System.IO.TextReader
- Text source, left open after opening and disposal.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Parsing and projection settings. Text is charged as UTF-8 against MaxInputBytes.
public static Task<CsvDataReader> OpenReaderAsync(string path, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Opens a forward-only CSV reader whose ReadAsync calls perform incremental asynchronous I/O. Initialization reads the header and, when requested, at most SchemaSampleRows data records. Delimiter detection replays a bounded prefix. Dispose the reader to close its file.
Parameters
- path string
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<CsvDataReader>public static Task<CsvDataReader> OpenReaderAsync(Stream stream, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Opens an incremental CSV reader at the stream's current position. The stream remains open on failure and after disposal; its position advances and is not restored. Read and HasRows may perform synchronous I/O; use ReadAsync for asynchronous consumption. Cancellation or a parsing failure ends the reader. The opening token remains active for its lifetime. Delimiter detection samples at most 64 Ki characters and replays the prefix.
Parameters
- stream System.IO.Stream
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<CsvDataReader>public static CsvDocument Parse(string text, CsvLoadOptions? options = null) #Parses a CSV document from text.
Parameters
- text string
- options OfficeIMO.CSV.CsvLoadOptions? = null
Returns
CsvDocumentpublic static IEnumerable<T?> ReadTextRowsAsParallel<T>(string text, CsvRecordFactoryBuilder<T?> factoryBuilder, CsvReaderOptions? options = null, ParallelRowMappingOptions? parallelOptions = null, CancellationToken cancellationToken = default) #Reads decoded CSV text and projects records through bounded workers while preserving source order.
Type Parameters
- T
- Result row type.
Parameters
- text string
- Decoded CSV text.
- factoryBuilder OfficeIMO.CSV.CsvRecordFactoryBuilder<T?>
- Builds the concurrent record factory from resolved headers.
- options OfficeIMO.CSV.CsvReaderOptions? = null
- Optional CSV parsing settings.
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- Optional worker and batch settings.
- cancellationToken System.Threading.CancellationToken = default
- Cancels parsing and pending projection work.
Returns
IEnumerable<T?>public CsvDocument RemoveColumn(string name) #Removes a column by name.
Parameters
- name string
Returns
CsvDocumentpublic void Save(CsvSaveOptions? options = null) #Saves to the path of the last successful path load or save.
Parameters
- options OfficeIMO.CSV.CsvSaveOptions? = null
public void Save(string path, CsvSaveOptions? options = null) #Saves the document to the specified path.
Parameters
- path string
- options OfficeIMO.CSV.CsvSaveOptions? = null
public void Save(Stream destination, CsvSaveOptions? options = null) #Saves the document to a caller-owned writable stream.
Parameters
- destination System.IO.Stream
- options OfficeIMO.CSV.CsvSaveOptions? = null
public Task SaveAsync(CsvSaveOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously saves to the associated path.
Parameters
- options OfficeIMO.CSV.CsvSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic async Task SaveAsync(string path, CsvSaveOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously saves the document to a path.
Parameters
- path string
- options OfficeIMO.CSV.CsvSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic Task SaveAsync(Stream destination, CsvSaveOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously saves the document to a caller-owned writable stream.
Parameters
- destination System.IO.Stream
- options OfficeIMO.CSV.CsvSaveOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic static void SaveObjects(string path, IEnumerable<object?> items, CsvSaveOptions? options = null) #Saves a sequence of objects directly as CSV without materializing a CsvDocument.
Parameters
- path string
- Destination CSV path.
- items System.Collections.Generic.IEnumerable<object?>
- Sequence of objects to convert into CSV rows.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional save settings.
public CsvDocument SortBy(string columnName, bool descending = false, IComparer<object?>? comparer = null) #Sorts rows by a column name.
Parameters
- columnName string
- descending bool = false
- comparer System.Collections.Generic.IComparer<object?>? = null
Returns
CsvDocumentpublic CsvDocument SortBy<TKey>(Func<CsvRow, TKey?> keySelector, bool descending = false, IComparer<TKey?>? comparer = null) #Sorts rows using a typed key selector.
Type Parameters
- TKey
Parameters
- keySelector System.Func<OfficeIMO.CSV.CsvRow, TKey?>
- descending bool = false
- comparer System.Collections.Generic.IComparer<TKey?>? = null
Returns
CsvDocumentpublic byte[] ToBytes(CsvSaveOptions? options = null) #Encodes the document using the selected CSV encoding and compression.
Parameters
- options OfficeIMO.CSV.CsvSaveOptions? = null
Returns
byte[]public DataTable ToDataTable(CsvDataTableOptions? options = null) #Projects the CSV document into a DataTable.
Parameters
- options OfficeIMO.CSV.CsvDataTableOptions? = null
- DataTable projection options. When omitted, all columns are emitted as strings.
Returns
DataTable A DataTable containing all document rows.public string ToString(CsvSaveOptions? options) #Serializes the document to a string using the provided save options.
Parameters
- options OfficeIMO.CSV.CsvSaveOptions?
Returns
stringpublic override string ToString() #Returns a string that represents the current object.
Returns
string A string that represents the current object.public CsvDocument Transform(Func<CsvDocument, CsvDocument> transformer) #Executes a custom transformation.
Parameters
- transformer System.Func<OfficeIMO.CSV.CsvDocument, OfficeIMO.CSV.CsvDocument>
Returns
CsvDocumentpublic CsvDocument Validate(out IReadOnlyList<CsvValidationError> errors) #Validates the document against the configured schema.
Parameters
- errors System.Collections.Generic.IReadOnlyList<OfficeIMO.CSV.CsvValidationError>
Returns
CsvDocumentpublic CsvDocument WithCulture(CultureInfo culture) #Sets the culture for type conversions.
Parameters
- culture System.Globalization.CultureInfo
Returns
CsvDocumentpublic CsvDocument WithDateTimeFormats(params string[] formats) #Sets additional date/time formats used by typed row conversion and schema validation.
Parameters
- formats string[]
Returns
CsvDocumentpublic CsvDocument WithDelimiter(char delimiter) #Sets the delimiter used for reading and writing.
Parameters
- delimiter char
Returns
CsvDocumentpublic CsvDocument WithDelimiter(string delimiter) #Sets a complete single- or multi-character delimiter for subsequent saves.
Parameters
- delimiter string
Returns
CsvDocumentpublic CsvDocument WithEncoding(Encoding encoding) #Sets the encoding used for file operations.
Parameters
- encoding System.Text.Encoding
Returns
CsvDocumentpublic CsvDocument WithHeader(params string[] headers) #Replaces the header row.
Parameters
- headers string[]
Returns
CsvDocumentpublic CsvDocument WithMappingErrorValuePolicy(DataMappingErrorValuePolicy policy) #Sets whether schema and row-mapping failures may include source values.
Parameters
- policy OfficeIMO.Data.DataMappingErrorValuePolicy
Returns
CsvDocumentpublic static void WriteDataReader(TextWriter writer, IDataReader reader, CsvSaveOptions? options = null) #Writes an IDataReader directly as CSV without materializing a CsvDocument.
Parameters
- writer System.IO.TextWriter
- Destination text writer.
- reader System.Data.IDataReader
- Source data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional save settings.
public static void WriteDataReader(TextWriter writer, IDataReader reader, CsvSaveOptions? options, CancellationToken cancellationToken) #Writes an IDataReader directly as CSV without materializing a CsvDocument.
Parameters
- writer System.IO.TextWriter
- Destination text writer.
- reader System.Data.IDataReader
- Source data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions?
- Optional save settings.
- cancellationToken System.Threading.CancellationToken
- Token observed while projecting and writing rows.
public static void WriteDataReader(string path, IDataReader reader, CsvSaveOptions? options = null) #Writes an open data reader to a CSV file.
Parameters
- path string
- Destination CSV path.
- reader System.Data.IDataReader
- Open data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- CSV serialization options.
public static void WriteDataReader(string path, IDataReader reader, CsvSaveOptions? options, CancellationToken cancellationToken) #Writes an open data reader to a CSV file.
Parameters
- path string
- Destination CSV path.
- reader System.Data.IDataReader
- Open data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions?
- CSV serialization options.
- cancellationToken System.Threading.CancellationToken
- Token observed while projecting and writing rows.
public static void WriteDataReader(Stream destination, IDataReader reader, CsvSaveOptions? options = null, bool leaveOpen = true) #Writes an open data reader to a CSV stream.
Parameters
- destination System.IO.Stream
- Writable destination stream.
- reader System.Data.IDataReader
- Open data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- CSV serialization options.
- leaveOpen bool = true
- Whether the destination stream remains open after writing.
public static void WriteDataReader(Stream destination, IDataReader reader, CsvSaveOptions? options, bool leaveOpen, CancellationToken cancellationToken) #Writes an open data reader to a CSV stream.
Parameters
- destination System.IO.Stream
- Writable destination stream.
- reader System.Data.IDataReader
- Open data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions?
- CSV serialization options.
- leaveOpen bool
- Whether the destination stream remains open after writing.
- cancellationToken System.Threading.CancellationToken
- Token observed while projecting and writing rows.
public static void WriteDataReaderParallel(TextWriter writer, IDataReader reader, CsvSaveOptions? options = null, CsvWriteParallelOptions? parallelOptions = null, CancellationToken cancellationToken = default) #Writes an open data reader to CSV with bounded, ordered parallel row formatting.
Parameters
- writer System.IO.TextWriter
- Destination text writer.
- reader System.Data.IDataReader
- Source data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional CSV serialization settings.
- parallelOptions OfficeIMO.CSV.CsvWriteParallelOptions? = null
- Optional worker and batch limits.
- cancellationToken System.Threading.CancellationToken = default
- Token observed while reading, formatting, and writing rows.
public static void WriteDataReaderParallel(string path, IDataReader reader, CsvSaveOptions? options = null, CsvWriteParallelOptions? parallelOptions = null, CancellationToken cancellationToken = default) #Writes an open data reader to a CSV file with bounded, ordered parallel row formatting.
Parameters
- path string
- Destination CSV path.
- reader System.Data.IDataReader
- Source data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional CSV serialization settings.
- parallelOptions OfficeIMO.CSV.CsvWriteParallelOptions? = null
- Optional worker and batch limits.
- cancellationToken System.Threading.CancellationToken = default
- Token observed while reading, formatting, and writing rows.
public static void WriteDataReaderParallel(Stream destination, IDataReader reader, CsvSaveOptions? options = null, CsvWriteParallelOptions? parallelOptions = null, bool leaveOpen = true, CancellationToken cancellationToken = default) #Writes an open data reader to a CSV stream with bounded, ordered parallel row formatting.
Parameters
- destination System.IO.Stream
- Writable destination stream.
- reader System.Data.IDataReader
- Source data reader positioned before the first row.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional CSV serialization settings.
- parallelOptions OfficeIMO.CSV.CsvWriteParallelOptions? = null
- Optional worker and batch limits.
- leaveOpen bool = true
- Whether the destination stream remains open after writing.
- cancellationToken System.Threading.CancellationToken = default
- Token observed while reading, formatting, and writing rows.
public static void WriteDataTable(TextWriter writer, DataTable table, CsvSaveOptions? options = null) #Writes a DataTable as CSV: its column names as the header, then its rows in order without the deleted ones, each value from the row's current version. The output is the same as writing the table's DataTable.CreateDataReader with CsvDocument.WriteDataReader, without the data table reader's cost per value.
Parameters
- writer System.IO.TextWriter
- Destination text writer.
- table System.Data.DataTable
- Source table with at least one column.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional save settings.
public static void WriteDataTable(Stream destination, DataTable table, CsvSaveOptions? options = null, bool leaveOpen = true) #Writes a DataTable as CSV to a stream, as CsvDocument.WriteDataTable does.
Parameters
- destination System.IO.Stream
- Writable destination stream.
- table System.Data.DataTable
- Source table with at least one column.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- CSV serialization options.
- leaveOpen bool = true
- Whether the destination stream remains open after writing.
public static void WriteObjects(TextWriter writer, IEnumerable<object?> items, CsvSaveOptions? options = null) #Writes a sequence of objects directly as CSV without materializing a CsvDocument.
Parameters
- writer System.IO.TextWriter
- Destination text writer.
- items System.Collections.Generic.IEnumerable<object?>
- Sequence of objects to convert into CSV rows.
- options OfficeIMO.CSV.CsvSaveOptions? = null
- Optional save settings.
Inherited Methods
Properties
public string DelimiterText { get; } #Gets the complete delimiter used when parsing and by default when saving.
public Encoding Encoding { get; } #Gets the encoding used when reading or writing files.
public IReadOnlyList<string>? DateTimeFormats { get; } #Gets the configured date/time formats used by typed conversions.
public DataMappingErrorValuePolicy MappingErrorValuePolicy { get; } #Gets how source values are represented in schema and row-mapping failures.
public string? FilePath { get; private set; } #Gets the path used by parameterless saves; stream and text loads have no associated path.
Extension Methods
public static IEnumerable<T> RowsAsParallel<T>(CsvDocument document, ParallelRowMappingOptions? parallelOptions = null, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Projects rows in bounded parallel batches, preserving source order.
Type Parameters
- T
Parameters
- document OfficeIMO.CSV.CsvDocument
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<T>public static IEnumerable<T?> RowsAsParallel<T>(CsvDocument document, Action<RowMapper<T?>> configure, ParallelRowMappingOptions? parallelOptions = null, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Projects rows in bounded parallel batches, preserving source order.
Type Parameters
- T
Parameters
- document OfficeIMO.CSV.CsvDocument
- configure System.Action<OfficeIMO.Data.RowMapper<T?>>
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<T?>public static IEnumerable<T?> RowsAsParallel<T>(CsvDocument document, Func<IDataRecord, T?> factory, ParallelRowMappingOptions? parallelOptions = null, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Projects rows in bounded parallel batches, preserving source order.
Type Parameters
- T
Parameters
- document OfficeIMO.CSV.CsvDocument
- factory System.Func<System.Data.IDataRecord, T?>
- parallelOptions OfficeIMO.Data.ParallelRowMappingOptions? = null
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<T?>public static IEnumerable<T?> RowsAs<T>(CsvDocument document, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Projects rows through the shared data-reader mapping contract.
Type Parameters
- T
Parameters
- document OfficeIMO.CSV.CsvDocument
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<T?>public static IEnumerable<T?> RowsAs<T>(CsvDocument document, Action<RowMapper<T?>> configure, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Projects rows through the shared data-reader mapping contract.
Type Parameters
- T
Parameters
- document OfficeIMO.CSV.CsvDocument
- configure System.Action<OfficeIMO.Data.RowMapper<T?>>
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<T?>public static IEnumerable<T?> RowsAs<T>(CsvDocument document, Func<IDataRecord, T?> factory, CsvReaderOptions? options = null, CancellationToken cancellationToken = default) #Projects rows through the shared data-reader mapping contract.
Type Parameters
- T
Parameters
- document OfficeIMO.CSV.CsvDocument
- factory System.Func<System.Data.IDataRecord, T?>
- options OfficeIMO.CSV.CsvReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<T?>