New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting FieldHeaders #737
Comments
Which version are you using? What object are you using? In old versions it
should be accessible directly on the reader object. In the latest version
it should be accessible on the context on the reader.
Linking a gist or pasting some code would enable us to more accurately
answer the question.
…On Aug 24, 2017 8:44 PM, "Codehhh" ***@***.***> wrote:
I just started using your package today but I can't figure out how to
easily get the FieldHeaders.
I see some issues that include csv.FieldHeaders but I can't seem to find
that in the code or any documentation. What is the simplest way for me to
get the FieldHeaders using your library?
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#737>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD_ohe9lOzGer9FPlLC1IY7EMVSBAIelks5sbhjRgaJpZM4PCGSq>
.
|
Sorry, I forgot to include the version I was using in my original post but I ninja edited after realizing. I'm using My code currently looks like the following:
|
|
Thank you! |
No problem! |
This solution doesn't work for me. It errors with: {"Method not found: 'CsvHelper.ReadingContext CsvHelper.CsvReader.get_Context()'."} | System.MissingMethodException I've using the latest version fromthe nuGet package. Is there another way to get the header data? |
I've had to hardcode the header data to get this to work. please get back to me. This is the first time I've used csvhelper, and it looks great, but failing to access header data is a big problem. The header data is in the FieldHeaders list, but not worth much if we cannot access it. |
I have tried the following and it works just fine for me with the current version of CsvHelper. var csv = new CsvReader( textReader );
csv.Read();
csv.ReadHeader();
var header = csv.Context.HeaderRecord;
var records = csv.GetRecords<MyClass>(); |
Thx for getting back to me, this is strange I tried the code below and it caused an error.
csv.ReadHeader();
Do you have any idea why? |
You need |
Ah!!! OK thx, I assumed the read header was independent or the read. I'll give this a try. Thx for your help. |
The error was written above: {"Method not found: 'CsvHelper.ReadingContext CsvHelper.CsvReader.get_Context()'."} | System.MissingMethodException But I'll give the read before a try and let you know what happens. |
Your issue may have to do with conflicting versions in your project. stackoverflow
|
OK, I'm running this in a DNN CMS. So I suppose it's possible, but I'm not aware of DNN using this, in fact I'm fairly sure it doesn't. But maybe I've overwritten an older version added by a module that was installed. I'll investigate. Thanks Again. |
You are correct. There is a module on the site which installs v2, I should have seen this before. Thank you for your help. |
I just started using your package today but I can't figure out how to easily get the FieldHeaders.
I see some issues that include
csv.FieldHeaders
but I can't seem to find that in the code or any documentation. What is the simplest way for me to get the FieldHeaders using your library?I'm currently using v3.0.0-chi06 and netcore v2.0.0
Thanks.
The text was updated successfully, but these errors were encountered: