CanleyCSVWriter

Namespace: Canley.Utility.CSV
Base Class: System.Object

Overview

The CanleyCSVWriter is a specialized utility class designed to convert C# data collections back into standardized CSV strings. It ensures that all exported data adheres to RFC 4180 standards, handling complex cases like cells containing commas, line breaks, or quotation marks automatically.

Unlike the Manager, the Writer is typically used as a static utility to prepare data for saving or network transmission.


Method Reference

Detailed documentation for each method can be found in the CanleyCSVWriter subfolder.

ClassMethod (Syntax)Description
CanleyCSVWriterExport(List<string[]> grid)The core engine. Converts a 2D list of strings into a single, valid CSV-formatted string.
CanleyCSVWriterWriteToFile(string path, string content)A power-user utility to write a string directly to any absolute path on the disk.

Key Features

  • RFC 4180 Compliance: Automatically handles the “double-quote escaping” required for professional CSV compatibility with Excel and Google Sheets.
  • Static Utility: Designed to be called directly without instantiation, making it lightweight and easy to integrate into existing save systems.
  • Format Consistency: Ensures that every row exported is properly terminated with cross-platform compatible newline characters.

TIP

When exporting data that will be read by the CanleyCSVManager later, ensure you include a header row as the first entry in your collection to maintain column-mapping compatibility.

2 items under this folder.