8 thoughts on “C# Read CSV file in .NET Core -TextFieldParser

  1. This looked so handy: no need for reflection, it builds a DataTable with all the right field names.
    Unfortunately, it would appear something has changed since you wrote this, or you’ve set serializer options that are not evident, because when I try to serialize an object this way, I get:
    Unhandled exception. System.NotSupportedException: The collection type ‘System.Data.DataRelationCollection’ on ‘System.Data.DataTable.ChildRelations’ is not supported.

    1. Thanks Derek for your query. Indeed this is very handy . Based on your comments , I did validate again and for me everything works perfectly fine.
      I am using newtonsoft 12.0.1 for serialization and deserialization. Please confim yours.
      Please confirm line number where you are getting this exception ? Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *