-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I'm trying to use CsvHelper to write a CSV file with dynamic columns from F#. The trouble is that F# doesn't have the dynamic keyword like C# does. You mentioned in 2017 in #709:
There is one weird issue though. It works with IEnumerable but gets that same exception for IEnumerable. I believe this is because it's only doing special logic when it's a dynamic type. Otherwise ExpandoObject is treated just like any other object, which wouldn't work well.
I believe that using an IEnumerable<dynamic> is the only way to write dynamic columns with CsvHelper, but this isn't how F# handles dynamic objects. In F#, to use dynamic objects, you still use the type ExpandoObject alongside the FSharp.Interop.Dynamic package. So it's impossible to create an IEnumerable<dynamic> - it would just be an IEnumerable<ExpandoObject>.
Is there any sort of workaround that I could use to create dynamic content without having to rely on IEnumerable<dynamic>?