Skip to content

API Overview

Marcus Ackre Medina edited this page Sep 13, 2026 · 1 revision

API Reference

Namespace: MarcusMedina.Fluent.Data.Extensions

CSV — on string

Method Description
ToCsvField(delimiter) Escapes value for use in a CSV line
FromCsvField() Unescapes a CSV field
SplitCsvLine(delimiter) Splits a CSV line respecting quoted fields
ToCsvLine(delimiter) Joins an IEnumerable<string> into a CSV line
FromCsvDocument(delimiter) Parses a full CSV document into IEnumerable<string[]> (one array per row)
FromCsv<T>(mapRow, hasHeaders, delimiter) Parses a full CSV document and maps each row to T via a delegate

CSV — on collections

Method Description
ToCsvLine(delimiter) IEnumerable<object?> → one CSV line (calls ToString() on each value)
ToCsvDocument(delimiter) IEnumerable<IEnumerable<object?>> → full CSV document (rows joined with Environment.NewLine)
ToCsvDocument<T>(mapRow, headers, delimiter) IEnumerable<T> → full CSV document, with an optional header row

JSON — on string

Method Description
ToJsonString() Escapes string for embedding in JSON
FromJsonString() Unescapes a JSON string
IsValidJson() Returns true if valid JSON

JSON — on objects

Method Description
ToJson<T>(writeIndented) Serializes any object to a JSON string (camelCase properties)
FromJson<T>() Deserializes a JSON string into T

XML — on string

Method Description
ToXmlContent() Escapes text for use as XML content
FromXmlContent() Decodes XML-encoded content

XML — on objects

Method Description
ToXmlAttributes() IEnumerable<KeyValuePair<string, object?>> → an XML attribute string (id="1" name="Anna")
ToXmlElement(content, attributes) Builds a full <element attr="...">content</element> string from an element name, content, and optional attributes

Not in this package

Base64, hex and URL-encoding helpers live in MarcusMedina.Fluent.Text (MarcusMedina.Fluent.Text.Core.Extensions.DataFormat), not here — MarcusMedina.Fluent.Data is scoped to CSV, JSON and XML.

Clone this wiki locally