F#: a complex record type and a DataGridView
I have a record type like this:
type Rule = {extension: string seq; subdir: string}
let rules : Rule list = // ...
And I want to bind it's instance to DataGridView. All my UI logic is implemented with C#. What is the best way to do this? Just make a reference to FSharp.Core in my C# project and bind? Or to make some simple record like this
type SimpleRule = {extension: string; subdir: string}
and a function that converts Rule list to a SimpleRule seq, which is represented as IEnumerable in C#. The second way seems to be the best because I don't need to make开发者_StackOverflow a reference to FSharp.Core and I will work with IEnumerable, but there is too much conversion code and I am having problems with writing it. Maybe there is a better way to solve the problem?
I ended up using mutable record. Also I've created some wrapper-class for my library, which have several methods to add/delete rules and apply them, so I don't use any of F# classes such as FSharpList in C#.
精彩评论