konrad konrad - 1 year ago 236
C# Question

reset enumerator to start for Lumenworks CSV Reader

I am using the CSV Reader from Lumenworks and its great but the

value is set only so when I get to the end of the file, and I want to read it again I can't since the current record is set to last item. Is there a way to reset that?

List<object> output = new List<object>();

var col = this.InternalCsv.GetFieldIndex(header);
var e = this.InternalCsv.GetEnumerator();
while (e.MoveNext())

Answer Source

Did you try IEnumerator.Reset


Sets the enumerator to its initial position, which is before the first element in the collection.

Or just Get the enumerator again.

var secondEnumerator = this.InternalCsv.GetEnumerator();

Also why you need to enumerate it again when you have the data in the List<object> output = new List<object>(); , use the data in the list !

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download