Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Convert FSharpList back to List in c#?

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.

like image 464
guerrillacodester Avatar asked Sep 01 '13 19:09

guerrillacodester


1 Answers

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();
like image 101
guerrillacodester Avatar answered Oct 16 '22 08:10

guerrillacodester