{"action":"created","issue":{"url":"https://api.github.com/repos/phatcher/CsvReader/issues/31","repository_url":"https://api.github.com/repos/phatcher/CsvReader","labels_url":"https://api.github.com/repos/phatcher/CsvReader/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/phatcher/CsvReader/issues/31/comments","events_url":"https://api.github.com/repos/phatcher/CsvReader/issues/31/events","html_url":"https://github.com/phatcher/CsvReader/issues/31","id":194386970,"number":31,"title":"Why is CsvReader forward only?","user":{"login":"Thierry-S","id":13853345,"avatar_url":"https://avatars2.githubusercontent.com/u/13853345?v=3","gravatar_id":"","url":"https://api.github.com/users/Thierry-S","html_url":"https://github.com/Thierry-S","followers_url":"https://api.github.com/users/Thierry-S/followers","following_url":"https://api.github.com/users/Thierry-S/following{/other_user}","gists_url":"https://api.github.com/users/Thierry-S/gists{/gist_id}","starred_url":"https://api.github.com/users/Thierry-S/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thierry-S/subscriptions","organizations_url":"https://api.github.com/users/Thierry-S/orgs","repos_url":"https://api.github.com/users/Thierry-S/repos","events_url":"https://api.github.com/users/Thierry-S/events{/privacy}","received_events_url":"https://api.github.com/users/Thierry-S/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-08T16:50:32Z","updated_at":"2017-06-04T14:56:20Z","closed_at":null,"body":"More of a question, initially thought it was a bug.\r\n\r\nI need to know how many lines are in my csv file.\r\nSo I did a `myCsvReader.Count()` (Linq) to get it. Of course, this moves the cursor forward to the end as it has to iterate it. But then I called `myCsvReader.GetEnumerator().Reset()` or even `myCsvReader.MoveTo(-1)` and they have no effect.\r\n\r\nI found this line of code in `MoveTo`:\r\n`    if (record < _currentRecordIndex)\r\n                    return false;\r\n`\r\nwhich confirm my thoughts that this is a forward only reader. \r\n\r\nThis msdn page (https://msdn.microsoft.com/en-us/library/65zzykke(v=vs.100).aspx) says that \r\n> Iterators do not support the IEnumerator.Reset method. To re-iterate from the beginning, you must obtain a new iterator.\r\n\r\nBut I've tried to do `var en2 = myCsvReader.GetEnumerator();` and that doesn't return a new iterator. It returns the existing iterator which points to the end.\r\n\r\nWhy? Why can't I go back to the begining?"},"comment":{"url":"https://api.github.com/repos/phatcher/CsvReader/issues/comments/306044950","html_url":"https://github.com/phatcher/CsvReader/issues/31#issuecomment-306044950","issue_url":"https://api.github.com/repos/phatcher/CsvReader/issues/31","id":306044950,"user":{"login":"phatcher","id":192778,"avatar_url":"https://avatars3.githubusercontent.com/u/192778?v=3","gravatar_id":"","url":"https://api.github.com/users/phatcher","html_url":"https://github.com/phatcher","followers_url":"https://api.github.com/users/phatcher/followers","following_url":"https://api.github.com/users/phatcher/following{/other_user}","gists_url":"https://api.github.com/users/phatcher/gists{/gist_id}","starred_url":"https://api.github.com/users/phatcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phatcher/subscriptions","organizations_url":"https://api.github.com/users/phatcher/orgs","repos_url":"https://api.github.com/users/phatcher/repos","events_url":"https://api.github.com/users/phatcher/events{/privacy}","received_events_url":"https://api.github.com/users/phatcher/received_events","type":"User","site_admin":false},"created_at":"2017-06-04T14:56:20Z","updated_at":"2017-06-04T14:56:20Z","body":"Slightly related point, have you looked at this http://sqlblog.com/blogs/alberto_ferrari/archive/2009/11/30/sqlbulkcopy-performance-analysis.aspx, relatively old, but gives a lot of performance analysis/ideas on SqlBulkCopy"}}
{"actor":{"display_login":"phatcher"}}