This project is read-only.
1

Closed

DataRecord and HeaderRecord constructors should take IList<String> or IEnumerable<string> for column names/values

description

<p>The library would be more robust if the string[] parameters of the HeaderRecord and DataRecord parameters took parameters more generic than string[]. IList&lt;string&gt; is a simple fix in which all unit tests still pass. IEnumerable&lt;string&gt; is harder because if you do that, passing string[] without an explicit cast leads to an ambibious resolution of params object[] and IEnumerable&lt;string&gt;. Also their is some code re-factoring to make sure you don&#39;t cause errors for IEnumerable&lt;string&gt; implementations that can only be enumerated once.</p>
Closed Mar 12, 2012 at 8:35 PM by
This is now fixed.

HeaderRecord and DataRecord both take IEnumerable<string> in their constructors.

CsvWriter.WriteHeaderRecord and CsvWriter.WriteDataRecord include overloads taking params object[], params string[], IEnumerable<object>, and IEnumerable<string>.

comments

zippy1981 wrote Aug 13, 2011 at 9:06 PM

Two patches uploaded. The IList one will just work. The IEnumerable does not compile and represents WIP.

One idea for IEnumerable is to also add constructors that use string[] to prevent ambigious column references.