/// <inheritdoc/> public void WriteCSV(ICSVDataElem singleElem) { StringBuilder builder = new StringBuilder(); bool firstColumn = true; foreach (string value in singleElem.GetCSVData) { // Add separator if this isn't the first value if (!firstColumn) { builder.Append(CSVFileInfo.SPLIT_CHAR); } // Implement special handling for values that contain comma or quote // Enclose in quotes and double up any double quotes if (value.IndexOfAny(new char[] { '"', ';' }) != -1) { builder.AppendFormat("\"{0}\"", value.Replace("\"", "\"\"")); } else { builder.Append(value); } firstColumn = false; } WriteLine(builder.ToString()); }
/// <inheritdoc/> public void Add(ICSVDataElem singleElem) { this._elements.Add(singleElem); }