Detailed Method Reference
Namespace: Canley.Utility.CSV
Class: CanleyCSVWriter
Export
public static string Export(List<string[]> grid)-
Description: Converts a list of string arrays into a standard-compliant CSV string. This is a static utility method, allowing for quick serialization without needing to instantiate a
CanleyCSVWriterobject. -
Workflow:
- Iterative Processing: Loops through each
string[]within the provided list. - Standard Compliance: Automatically handles special characters. If a cell contains a comma (
,), a newline (\n), or a double-quote ("), the method wraps the cell in quotes and escapes internal quotes. - Serialization: Joins row elements with a comma and appends the appropriate line terminator.
- Iterative Processing: Loops through each
-
Parameters:
grid: AList<string[]>representing the rows and columns to be serialized.
-
Returns:
string(The full, formatted CSV content). -
Example:
// Assuming myGridData is a List<string[]>
string output = CanleyCSVWriter.Export(myGridData);IMPORTANT
Use this static method when you already have your data structured in memory and simply need a one-off conversion to a CSV string.