paulyoder / LinqToExcel

Use LINQ to retrieve data from spreadsheets and csv files
MIT License
1.06k stars 299 forks source link

Fixed case where UnmappedCells is null #187

Closed bogdanbujdea closed 1 week ago

bogdanbujdea commented 3 years ago

There are two changes in this PR:

  1. If the class implements IContainsUnmappedCells, then initialize the collection UnmappedCells, so the user has to only implement the interface. Otherwise, the user would have to create a constructor and initialize the dictionary in there, which you realize you have to do only if you pull the source code and debug through it.
  2. Allow a setter on the UnmappedCells dictionary for situations where you would want to serialize the object but without the UnmappedCells. In this case, you can set UnmappedCells to null, and tell the serializer to ignore null values. If you think this is not such a common scenario, I can remove this change.