I have an F# library that returns an FSharpList to my C# caller.
I would now like my C# caller's code to convert this into a List.
What is the most efficient way to do this in C#?
Thanks.
I have an F# library that returns an FSharpList to my C# caller.
I would now like my C# caller's code to convert this into a List.
What is the most efficient way to do this in C#?
Thanks.
Easier than I thouglt...
Starting with:
List<double> niceList= new List<double>();
From List
to FSharpList
I did this:
FSharpList<double> niceSharpList = ListModule.OfSeq(niceList);
and to convert back from FSharpList
to List
I did:
List<double> niceList= niceSharpList.ToList();
To make this work it is essential to add references to the project core F # 4.0
For example in F# you have this
/// A list with 3 integers
let listA = [ 1; 2; 3 ]
you can use in C# in very simply way
List<Int32> listCSHARP = Module1.listA.ToList();
foreach (Int32 i in listCSHARP)
{
MessageBox.Show(i.ToString());
}